Skip to content

Instantly share code, notes, and snippets.

@epchris
Created October 13, 2014 14:58
Show Gist options
  • Save epchris/f6180ea5c8dfdbf74f77 to your computer and use it in GitHub Desktop.
Save epchris/f6180ea5c8dfdbf74f77 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Autogenerated by foreman
### BEGIN INIT INFO
# Provides: app-clock
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: app-clock
# Description: app-clock
### END INIT INFO
NAME=app-clock
DESC=app-clock
DAEMON=/Users/chris.tenharmsel/centro/centro-media-manager/bundle
DAEMON_USER=app
PIDDIR=/var/run/app-clock
PIDFILE=/var/run/app-clock/app-clock.pid
test -x ${DAEMON} || exit 0
set -e
. /lib/lsb/init-functions
case "${1}" in
start)
log_daemon_msg "Starting ${DESC}" "${NAME}"
mkdir -p ${PIDDIR}
if (start-stop-daemon --start --make-pidfile --background --pidfile $PIDFILE --chuid $DAEMON_USER --exec $DAEMON -- exec clockwork lib/clock.rb); then
log_end_msg 0
else
log_end_msg 1
fi
;;
stop)
log_daemon_msg "Stopping ${DESC}" "${NAME}"
if (start-stop-daemon --stop --oknodo --retry 20 --pidfile $PIDFILE --chuid $DAEMON_USER); then
log_end_msg 0
else
log_end_msg 1
fi
;;
status)
status_of_proc -p ${PIDFILE} ${DAEMON} ${NAME}
;;
restart)
${0} stop
${0} start
;;
*)
echo "Usage: ${0} {start|stop|status|restart}" >&2
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment