Skip to content

Instantly share code, notes, and snippets.

@nemf
Created June 10, 2012 08:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nemf/2904515 to your computer and use it in GitHub Desktop.
Save nemf/2904515 to your computer and use it in GitHub Desktop.
SparkleShare Dashboard Start/Stop Script
#!/bin/sh
# chkconfig: - 85 15
### BEGIN INIT INFO
# Version : 0.2
# Author : Fabrice MARCHAL
# Provides: sparkleshare
# Short-Description: SparkleShare Dashboard
# Description: Launches the SparkleShare Dashboard as service.
# Require : forever.js ( to install execute : npm install forever -g )
### END INIT INFO
NAME=sparkleshare
DESC="SparkleShare Dashboard"
NODE=/usr/bin/node
DASHBOARD=/usr/local/SparkleShare-Dashboard
USER=git
stop()
{
echo -e "Stopping $DESC: $NAME"
cd $DASHBOARD
su $USER -c "export NODE_ENV=production ;forever stop app.js"
}
start()
{
echo -e "Starting $DESC: $NAME"
cd $DASHBOARD
su $USER -c "export NODE_ENV=production ;forever start app.js"
}
case "$1" in
start)
start
case "$?" in
0) echo -e " [ OK ]" ; exit 0 ;;
*) echo -e " [ failed ]" ; exit 1 ;;
esac
;;
stop)
stop
case "$?" in
0) echo -e " [ OK ]" ; exit 0 ;;
*) echo -e " [ failed ]" ; exit 1 ;;
esac
;;
restart|force-reload|reload)
echo -e "Restarting $DESC: $NAME\n"
stop
start
;;
*)
echo "Usage: /etc/init.d/sparkleshare {start|stop|reload|force-reload|re
start}" >&2
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment