Skip to content

Instantly share code, notes, and snippets.

@hSATAC
Forked from couraudt/uniqush-push
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hSATAC/87f7a598ed185b870141 to your computer and use it in GitHub Desktop.
Save hSATAC/87f7a598ed185b870141 to your computer and use it in GitHub Desktop.
#!/bin/sh
### BEGIN INIT INFO
# Provides: uniqush-push
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts uniqush-push
# Description: Starts Uniqush provides a unified push service for server-side notification to apps on mobile devices.
### END INIT INFO
DAEMON="/usr/bin/uniqush-push"
CONF_FILE="/etc/uniqush/uniqush-push.conf"
PID=/run/uniqush-push.pid
NAME=uniqush-push
DESC=uniqush-push
SRV_UID=nobody
SRV_GID=nogroup
test -x $DAEMON || exit 0
set -e
. /lib/lsb/init-functions
start() {
start-stop-daemon --start --quiet --pidfile $PID --chuid ${SRV_UID}:${SRV_GID} --user $SRV_UID --group $SRV_GID \
--retry 5 --exec $DAEMON --oknodo --make-pidfile --background -- -config="$CONF_FILE"
}
stop() {
start-stop-daemon --stop --quiet --pidfile $PID \
--retry 5 --oknodo --exec $DAEMON
}
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
start
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
stop
log_end_msg $?
;;
restart)
log_daemon_msg "Restarting $DESC" "$NAME"
stop
sleep 1
start
log_end_msg $?
;;
status)
status_of_proc -p $PID "$DAEMON" "$NAME"
;;
*)
echo "Usage: $NAME {start|stop|restart|status}" >&2
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment