jellyfin/debian/jellyfin.init

50 lines
1.2 KiB
Plaintext
Raw Normal View History

2018-12-09 18:45:08 -05:00
### BEGIN INIT INFO
# Provides: Jellyfin Media Server
2018-12-09 17:33:40 -05:00
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
2018-12-09 18:45:08 -05:00
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Jellyfin Media Server
# Description: Runs Jellyfin Server
2018-12-09 18:45:08 -05:00
### END INIT INFO
2018-12-09 17:33:40 -05:00
# Carry out specific functions when asked to by the system
pidfile="/var/run/jellyfin.pid"
pid=`cat $pidfile`
2018-12-09 18:45:08 -05:00
case "$1" in
start)
2018-12-09 17:33:40 -05:00
if [ "$pid" == "" ]; then
echo "Starting Jellyfin..."
2018-12-12 19:14:20 -05:00
. /etc/default/jellyfin
nohup su -u $JELLYFIN_USER -c /usr/bin/jellyfin $JELLYFIN_ARGS
echo ?? > $pidfile
2018-12-09 17:33:40 -05:00
else
echo "Jellyfin already running"
2018-12-09 17:33:40 -05:00
fi
2018-12-09 18:45:08 -05:00
;;
stop)
2018-12-09 17:33:40 -05:00
if [ "$pid" != "" ]; then
echo "Stopping Jellyfin..."
2018-12-09 17:33:40 -05:00
kill $pid
sleep 2
rm -f $pidfile
2018-12-09 17:33:40 -05:00
else
echo "Jellyfin not running"
2018-12-09 17:33:40 -05:00
fi
2018-12-09 18:45:08 -05:00
;;
status)
2018-12-09 17:33:40 -05:00
if [ "$pid" != "" ]; then
echo "Jellyfin running as $pid"
2018-12-09 17:33:40 -05:00
ps -f $pid
else
echo "Jellyfin is not running"
2018-12-09 17:33:40 -05:00
fi
;;
2018-12-09 18:45:08 -05:00
*)
2018-12-09 17:33:40 -05:00
echo "Usage: $0 {start|stop}"
exit 1
2018-12-09 18:45:08 -05:00
;;
esac