#!/bin/sh
### BEGIN INIT INFO
# Provides: jellyfin
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Jellyfin Media Server
# Description: Starts the Jellyfin Media Server
### END INIT INFO
JELLYFIN_BIN="/usr/lib/jellyfin/bin/jellyfin"
PIDFILE="/var/run/jellyfin.pid"
LOGFILE="/var/log/jellyfin/jellyfin.log"
case "$1" in
start)
echo "Starting Jellyfin..."
nohup $JELLYFIN_BIN > $LOGFILE 2>&1 &
echo $! > $PIDFILE
echo "Jellyfin started with PID $(cat $PIDFILE)"
;;
stop)
echo "Stopping Jellyfin..."
kill $(cat $PIDFILE)
rm -f $PIDFILE
echo "Jellyfin stopped"
;;
restart)
$0 stop
$0 start
;;
status)
if [ -f $PIDFILE ]; then
echo "Jellyfin is running with PID $(cat $PIDFILE)"
else
echo "Jellyfin is not running"
fi
;;
*)
echo "Usage: /etc/init.d/jellyfin {start|stop|restart|status}"
exit 1
;;
esac
exit 0
jellyfin
最新推荐文章于 2025-12-20 15:12:19 发布
3万+

被折叠的 条评论
为什么被折叠?



