aboutsummaryrefslogtreecommitdiff
path: root/debian/conf
diff options
context:
space:
mode:
Diffstat (limited to 'debian/conf')
-rw-r--r--debian/conf/jellyfin.init62
-rw-r--r--debian/conf/jellyfin.service17
-rw-r--r--debian/conf/jellyfin.upstart20
3 files changed, 99 insertions, 0 deletions
diff --git a/debian/conf/jellyfin.init b/debian/conf/jellyfin.init
new file mode 100644
index 0000000..784536d
--- /dev/null
+++ b/debian/conf/jellyfin.init
@@ -0,0 +1,62 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: Jellyfin Media Server
+# Required-Start: $local_fs $network
+# Required-Stop: $local_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Jellyfin Media Server
+# Description: Runs Jellyfin Server
+### END INIT INFO
+
+set -e
+
+# 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"
+
+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
+ ;;
+
+ 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
+ ;;
+
+ 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
+ ;;
+
+ status)
+ status_of_proc -p $PIDFILE /usr/bin/jellyfin jellyfin && exit 0 || exit $?
+ ;;
+
+ *)
+ echo "Usage: $0 {start|stop|restart|status}"
+ exit 1
+ ;;
+esac
diff --git a/debian/conf/jellyfin.service b/debian/conf/jellyfin.service
new file mode 100644
index 0000000..2cc49f7
--- /dev/null
+++ b/debian/conf/jellyfin.service
@@ -0,0 +1,17 @@
+[Unit]
+Description = Jellyfin Media Server
+After = network-online.target
+
+[Service]
+Type = simple
+EnvironmentFile = /etc/default/jellyfin
+User = jellyfin
+Group = jellyfin
+WorkingDirectory = /var/lib/jellyfin
+ExecStart = /usr/bin/jellyfin $JELLYFIN_WEB_OPT $JELLYFIN_FFMPEG_OPT $JELLYFIN_SERVICE_OPT $JELLYFIN_NOWEBAPP_OPT $JELLYFIN_ADDITIONAL_OPTS
+Restart = on-failure
+TimeoutSec = 15
+SuccessExitStatus=0 143
+
+[Install]
+WantedBy = multi-user.target
diff --git a/debian/conf/jellyfin.upstart b/debian/conf/jellyfin.upstart
new file mode 100644
index 0000000..ef5bc9b
--- /dev/null
+++ b/debian/conf/jellyfin.upstart
@@ -0,0 +1,20 @@
+description "jellyfin daemon"
+
+start on (local-filesystems and net-device-up IFACE!=lo)
+stop on runlevel [!2345]
+
+console log
+respawn
+respawn limit 10 5
+
+kill timeout 20
+
+script
+ set -x
+ echo "Starting $UPSTART_JOB"
+
+ # Log file
+ logger -t "$0" "DEBUG: `set`"
+ . /etc/default/jellyfin
+ exec su -u $JELLYFIN_USER -c /usr/bin/jellyfin $JELLYFIN_ARGS
+end script
bgstack15