Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
61 lines (56 sloc) 1.41 KB
#!/bin/sh
#
# /etc/init.d/popcorn-server
#
### BEGIN INIT INFO
# Provides: popcorn-server
# Required-Start: $syslog $remote_fs
# Should-Start:
# Required-Stop: $syslog $remote_fs
# Should-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: Popcorn server
# Description: Starts and stops the Popcorn service
### END INIT INFO
. /etc/rc.status
EXEC=/usr/sbin/popcorn-server
PIDFILE=/var/run/popcorn-server.pid
case "$1" in
start)
if [ ! -r $PIDFILE ]; then
touch $PIDFILE
chown popcorn:popcorn $PIDFILE
fi
echo -n "Starting service Popcorn server "
/sbin/startproc -u popcorn -g popcorn -p $PIDFILE -s -e $EXEC >/dev/null 2>&1
rc_status -v
;;
stop)
if [ ! -f $PIDFILE ]
then
echo -n "$PIDFILE does not exist, process is not running"
rc_failed
else
echo -n "Stopping service Popcorn server "
/sbin/killproc -p $PIDFILE $EXEC >/dev/null 2>&1
fi
rc_status -v
;;
restart)
$0 stop
$0 start
;;
reload)
$0 restart
;;
status)
echo -n "Checking for service Popcorn server "
/sbin/checkproc -p $PIDFILE $EXEC
rc_status -v
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload}"
exit 1
esac
rc_exit