diff --git a/src/system-configs/upstart-configs/units/webida-batch.conf b/src/system-configs/upstart-configs/units/webida-batch.conf new file mode 100644 index 0000000..068836a --- /dev/null +++ b/src/system-configs/upstart-configs/units/webida-batch.conf @@ -0,0 +1,29 @@ +#!upstart +description "Webida batch" +author "Webida team" + +start on startup +stop on shutdown + +# Set the priv of scripts +# If this not not set, the Webida server will be run as root and it'll be a disaster. +setuid webida + +# This let upstart track the child process of forever. +# Because forever spawns another monitor process and exits, this is required. +expect fork + +env WEBIDA_HOME="/home/webida" +env SERVER_DIR="webida-server/src/server" +env LOG="/dev/null" +env NODE_ENV='production' + +env SCRIPT="unit-manager.js svc=batch0" + +script + exec forever --sourceDir "$SERVER_ROOT/$SERVER_DIR" -a -l $LOG --minUptime 5000 --spinSleepTime 2000 start $SCRIPT +end script + +pre-stop script + exec forever stop $SCRIPT +end script