Switched nodemon to foreverjs to hopefully enable restarting internally and fix runtime errors

This commit is contained in:
Isaac Abadi
2021-03-20 16:22:59 -06:00
parent aefdde5401
commit addd54fefd
4 changed files with 4 additions and 11 deletions

View File

@@ -335,18 +335,11 @@ async function startServer() {
}
async function restartServer(is_update = false) {
const restartProcess = () => {
spawn('node', ['app.js'], {
detached: true,
stdio: 'inherit'
}).unref()
process.exit()
}
logger.info(`${is_update ? 'Update complete! ' : ''}Restarting server...`);
// the following line restarts the server through nodemon
fs.writeFileSync(`restart${is_update ? '_update' : '_general'}.json`, 'internal use only');
process.exit(1);
}
async function updateServer(tag) {

View File

@@ -1,7 +1,7 @@
#!/bin/sh
set -eu
CMD="nodemon app.js"
CMD="forever app.js"
# if the first arg starts with "-" pass it to program
if [ "${1#-}" != "$1" ]; then

View File

@@ -4,7 +4,6 @@
"description": "backend for YoutubeDL-Material",
"main": "index.js",
"scripts": {
"preinstall": "npm i nodemon -g",
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon app.js"
},