mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Moved submodules and every stuff into seperate folders neatly #4
This commit is contained in:
22
src/utils/motd.js
Executable file
22
src/utils/motd.js
Executable file
@@ -0,0 +1,22 @@
|
||||
const utils = require('../utils/utils.js')
|
||||
const dataFile = '../public/data.json'
|
||||
const motdFile = '../public/motd'
|
||||
|
||||
var p = GetParams()
|
||||
if (p.length <= 0) {
|
||||
console.log('no params!')
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
var param = p.join(' ')
|
||||
console.log('param: ' + param)
|
||||
var d = utils.ReadFile(dataFile)
|
||||
var parsed = JSON.parse(d)
|
||||
parsed.motd = param
|
||||
utils.WriteFile(JSON.stringify(parsed), dataFile)
|
||||
|
||||
utils.WriteFile(parsed.motd, motdFile)
|
||||
|
||||
function GetParams () {
|
||||
return process.argv.splice(2)
|
||||
}
|
||||
Reference in New Issue
Block a user