Skip to content

Instantly share code, notes, and snippets.

@naveda89
Forked from tcopple/resque-web.init.d
Last active December 17, 2015 02:58
Show Gist options
  • Save naveda89/5539414 to your computer and use it in GitHub Desktop.
Save naveda89/5539414 to your computer and use it in GitHub Desktop.
#! /bin/sh
### BEGIN INIT INFO
# Provides: resque-web
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: web interface for resque processing
# Description: resque-web interface for resque
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=resque-web
DESC=resque-web
USER=resquer
GROUP=resquer
DAEMON=/home/$USER/.rvm/bin/boot_resque-web
DAEMON_START_ARGS="-L -p 4001"
DAEMON_STOP_ARGS="-K"
test -x $DAEMON || exit 0
test -x $DAEMONBOOTSTRAP || exit 0
set -e
case "$1" in
start)
echo -n "Starting $DESC: "
echo "\n"$DAEMON $DAEMON_START_ARGS
if start-stop-daemon --start --umask 007 --chuid $USER:$GROUP --exec $DAEMON -- $DAEMON_START_ARGS
then
echo "$NAME."
else
echo "failed"
fi
;;
stop)
echo -n "Stopping $DESC: "
echo "\n"$DAEMON $DAEMON_STOP_ARGS
if start-stop-daemon --start --umask 007 --chuid $USER:$GROUP --exec $DAEMON -- $DAEMON_STOP_ARGS
then
echo "$NAME."
else
echo "failed"
fi
;;
restart|force-reload)
${0} stop
${0} start
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment