Browse Source

Merge branch 'master' of crubardugit:~/root/bobinoscope

bob
P.BARRY 10 years ago
parent
commit
749729ee75
1 changed files with 77 additions and 0 deletions
  1. 77
      njs-bobinoscope

77
njs-bobinoscope

@ -0,0 +1,77 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: /home/cocoon/workspace/bobinoscope/bin/www
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: forever running /home/cocoon/workspace/bobinoscope/bin/www
# Description: /home/cocoon/workspace/bobinoscope/bin/www
### END INIT INFO
#
# initd a node app
# Based on a script posted by https://gist.github.com/jinze at https://gist.github.com/3748766
#
# Source function library.
. /lib/lsb/init-functions
pidFile="/var/run/njs-bobinoscope.pid"
logFile="/var/log/njs-bobinoscope"
command="/usr/local/bin/node"
nodeApp="/home/cocoon/workspace/bobinoscope/bin/www"
foreverApp="/usr/local/bin/forever"
start() {
echo "Starting $nodeApp"
# Notice that we change the PATH because on reboot
# the PATH does not include the path to node.
# Launching forever with a full path
# does not work unless we set the PATH.
PATH=/usr/local/bin:$PATH
export NODE_ENV=production
#PORT=80
$foreverApp start --pidFile $pidFile -l $logFile -a -d -c "$command" $nodeApp
RETVAL=$?
}
restart() {
echo -n "Restarting $nodeApp"
$foreverApp restart $nodeApp
RETVAL=$?
}
stop() {
echo -n "Shutting down $nodeApp"
$foreverApp stop $nodeApp
RETVAL=$?
}
status() {
echo -n "Status $nodeApp"
$foreverApp list
RETVAL=$?
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
restart
;;
*)
echo "Usage: {start|stop|status|restart}"
exit 1
;;
esac
exit $RETVAL
Loading…
Cancel
Save