Created
September 7, 2014 18:25
-
-
Save detrout/89e9224db740f254d0cb to your computer and use it in GitHub Desktop.
This file contains 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/bash | |
# /etc/init.d/pumpio | |
### BEGIN INIT INFO | |
# Provides: pump.io | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts pump.io as a background daemon | |
# Description: Starts pump.io on boot | |
### END INIT INFO | |
# Author: Bob Mottram <[email protected]> | |
#Settings | |
SERVICE='pumpio' | |
DAEMON='/opt/pump.io/bin/pump' | |
USERNAME='pumpio' | |
NICELEVEL=19 # from 0-19 the bigger the number, the less the impact on system resources | |
HISTORY=1024 | |
INVOCATION="nice -n ${NICELEVEL} ${COMMAND}" | |
PATH='/usr/bin:/sbin:/usr/sbin:/bin:/opt/pump.io/bin:/opt/pump.io/npm_modules/forever/bin' | |
pumpio_start() { | |
echo "Starting $SERVICE..." | |
start-stop-daemon --user ${USERNAME} -p /var/run/pumpio.run --start -b --exec ${DAEMON} | |
} | |
pumpio_stop() { | |
echo "Stopping $SERVICE" | |
start-stop-daemon --user ${USERNAME} -p /var/run/pumpio.run --stop -b --exec ${DAEMON} | |
} | |
#Start-Stop here | |
case "$1" in | |
start) | |
pumpio_start | |
;; | |
stop) | |
pumpio_stop | |
;; | |
restart) | |
pumpio_stop | |
sleep 5 | |
pumpio_start | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart}" | |
exit 1 | |
;; | |
esac | |
exit 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment