jellyfin.init 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ### BEGIN INIT INFO
  2. # Provides: Jellyfin Media Server
  3. # Required-Start: $local_fs $network
  4. # Required-Stop: $local_fs
  5. # Default-Start: 2 3 4 5
  6. # Default-Stop: 0 1 6
  7. # Short-Description: Jellyfin Media Server
  8. # Description: Runs Jellyfin Server
  9. ### END INIT INFO
  10. # Carry out specific functions when asked to by the system
  11. pid=`ps -fA|grep dotnet|grep JellyfinServer|awk '{print $2}'| tr -d '\n'`
  12. case "$1" in
  13. start)
  14. if [ "$pid" == "" ]; then
  15. echo "Starting Jellyfin..."
  16. nohup dotnet /usr/lib/jellyfin/bin/EmbyServer.dll >/dev/null 2>&1 &
  17. else
  18. echo "Jellyfin already running"
  19. fi
  20. ;;
  21. stop)
  22. if [ "$pid" != "" ]; then
  23. echo "Stopping Jellyfin..."
  24. kill $pid
  25. sleep 2
  26. else
  27. echo "Jellyfin not running"
  28. fi
  29. ;;
  30. status)
  31. if [ "$pid" != "" ]; then
  32. echo "Jellyfin running as $pid"
  33. ps -f $pid
  34. else
  35. echo "Jellyfin is not running"
  36. fi
  37. ;;
  38. *)
  39. echo "Usage: $0 {start|stop}"
  40. exit 1
  41. ;;
  42. esac