Created
October 9, 2010 23:34
-
-
Save skaurus/618726 to your computer and use it in GitHub Desktop.
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 characters
#!/bin/sh | |
# | |
# chkconfig: 345 85 15 | |
# description: Mojolicious app init.d script | |
# Source function library. | |
. /etc/rc.d/init.d/functions | |
# Source networking configuration. | |
. /etc/sysconfig/network | |
# Check that networking is up. | |
[ "$NETWORKING" = "no" ] && exit 0 | |
APPNAME=around | |
CHILDS=10 | |
start() { | |
echo "starting up Around Project" | |
daemon rm -f /tmp/$APPNAME.sock | |
daemon /var/$APPNAME/script/$APPNAME daemon_prefork --listen file:///tmp/$APPNAME.sock --pid /tmp/$APPNAME.pid --lock /tmp/$APPNAME.lock --start $CHILDS & | |
sleep 2 | |
chmod a+w /tmp/$APPNAME.sock | |
# if [ "$?" -eq 0 ]; then | |
# echo -e "\nDone." | |
# else | |
# echo -e "\nFAILED." | |
# fi | |
} | |
stop() { | |
`ps aux | grep perl | grep "/tmp/$APPNAME.sock" | head -n 1 | awk '{print ($2)}' | xargs kill` | |
} | |
status() { | |
RUN=`ps aux | grep perl | grep "/tmp/$APPNAME.sock" | wc | awk '{print ($1)}'` | |
if [ $RUN -gt 0 ]; then | |
echo "Running." | |
else | |
echo "Not Running." | |
fi | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
restart) | |
stop | |
sleep 2 | |
start | |
;; | |
stop) | |
stop | |
;; | |
status) | |
status | |
;; | |
*) | |
echo "usage : $0 start|restart|stop|status" | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment