jellyfin/deployment/debian-package-x64/pkg-src/jellyfin.init

62 lines
1.6 KiB
Plaintext
Raw Normal View History

2018-12-09 23:45:08 +00:00
### BEGIN INIT INFO
# Provides: Jellyfin Media Server
2018-12-09 22:33:40 +00:00
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
2018-12-09 23:45:08 +00:00
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Jellyfin Media Server
# Description: Runs Jellyfin Server
2018-12-09 23:45:08 +00:00
### END INIT INFO
set -e
2018-12-09 22:33:40 +00:00
# Carry out specific functions when asked to by the system
if test -f /etc/default/jellyfin; then
. /etc/default/jellyfin
fi
. /lib/lsb/init-functions
PIDFILE="/run/jellyfin.pid"
2018-12-09 23:45:08 +00:00
case "$1" in
start)
log_daemon_msg "Starting Jellyfin Media Server" "jellyfin" || true
if start-stop-daemon --start --quiet --oknodo --background --pidfile $PIDFILE --make-pidfile --user $JELLYFIN_USER --chuid $JELLYFIN_USER --exec /usr/bin/jellyfin -- $JELLYFIN_ARGS; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
2018-12-09 23:45:08 +00:00
;;
2018-12-09 23:45:08 +00:00
stop)
log_daemon_msg "Stopping Jellyfin Media Server" "jellyfin" || true
if start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --remove-pidfile; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
2018-12-09 23:45:08 +00:00
;;
restart)
log_daemon_msg "Restarting Jellyfin Media Server" "jellyfin" || true
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $PIDFILE --remove-pidfile
if start-stop-daemon --start --quiet --oknodo --background --pidfile $PIDFILE --make-pidfile --user $JELLYFIN_USER --chuid $JELLYFIN_USER --exec /usr/bin/jellyfin -- $JELLYFIN_ARGS; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
;;
2018-12-09 23:45:08 +00:00
status)
status_of_proc -p $PIDFILE /usr/bin/jellyfin jellyfin && exit 0 || exit $?
2018-12-09 22:33:40 +00:00
;;
2018-12-09 23:45:08 +00:00
*)
echo "Usage: $0 {start|stop|restart|status}"
2018-12-09 22:33:40 +00:00
exit 1
2018-12-09 23:45:08 +00:00
;;
esac