Created
October 23, 2012 03:28
-
-
Save morphizer/3936465 to your computer and use it in GitHub Desktop.
Revisions
-
morphizer created this gist
Oct 23, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,65 @@ #!/bin/bash # # servicename Starts and stops a service # # chkconfig: 345 90 30 # description: Example init script for older node.js application using spark # # processname: servicename ### BEGIN INIT INFO # Provides: servicename # Required-Start: $local_fs $network # Required-Stop: $local_fs # Default-Start: 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start the node.js server for servicename # Description: ### END INIT INFO # Source function library . /etc/init.d/functions SERVICENAME_BIN=/usr/local/project/bin/project lockfile=/var/lock/subsys/project logfile=/var/log/project/project.log start() { echo -n "Starting project: " [ -x $SERVICENAME_BIN ] || exit 5 daemon --check project "$SERVICENAME_BIN >> $logfile &" RETVAL=$? echo [ $RETVAL -eq 0 ] && touch $lockfile return $RETVAL } stop() { echo -n "Shutting down project: " killproc $SERVICENAME_BIN RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f $lockfile return $RETVAL } case "$1" in start) start ;; stop) stop ;; status) status $SERVICENAME_BIN ;; restart) stop start ;; *) echo "Usage: $0 {start|stop|status|restart}" exit 2 ;; esac exit $? This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ #!/usr/local/bin/node process.chdir(__dirname + '/..'); require('../node_modules/.bin/spark');