Run explicit service start if restart failed

Should solve the occasional bugs with the restart in the WebUI.
Sometimes the service stops and then doesn't start again; this will run
an explicit start action afterwards. If this doesn't fix it I'm certain
there would be more tweaking that can be done.
This commit is contained in:
Joshua M. Boniface 2020-11-22 17:12:29 -05:00
parent 3442dbbaf9
commit 1079ddb46c
2 changed files with 6 additions and 6 deletions

View File

@ -24,13 +24,13 @@ cmd="$( get_service_command )"
echo "Detected service control platform '$cmd'; using it to restart Jellyfin..." echo "Detected service control platform '$cmd'; using it to restart Jellyfin..."
case $cmd in case $cmd in
'systemctl') 'systemctl')
echo "sleep 2; /usr/bin/sudo $( which systemctl ) restart jellyfin" | at now echo "sleep 2; /usr/bin/sudo $( which systemctl ) restart jellyfin || /usr/bin/sudo $( which systemctl ) start jellyfin" | at now
;; ;;
'service') 'service')
echo "sleep 2; /usr/bin/sudo $( which service ) jellyfin restart" | at now echo "sleep 2; /usr/bin/sudo $( which service ) jellyfin restart || /usr/bin/sudo $( which service ) jellyfin start" | at now
;; ;;
'sysv') 'sysv')
echo "sleep 2; /usr/bin/sudo /etc/init.d/jellyfin restart" | at now echo "sleep 2; /usr/bin/sudo /etc/init.d/jellyfin restart || /usr/bin/sudo /etc/init.d/jellyfin start" | at now
;; ;;
esac esac
exit 0 exit 0

View File

@ -24,13 +24,13 @@ cmd="$( get_service_command )"
echo "Detected service control platform '$cmd'; using it to restart Jellyfin..." echo "Detected service control platform '$cmd'; using it to restart Jellyfin..."
case $cmd in case $cmd in
'systemctl') 'systemctl')
echo "sleep 2; /usr/bin/sudo $( which systemctl ) restart jellyfin" | at now echo "sleep 2; /usr/bin/sudo $( which systemctl ) restart jellyfin || /usr/bin/sudo $( which systemctl ) start jellyfin" | at now
;; ;;
'service') 'service')
echo "sleep 2; /usr/bin/sudo $( which service ) jellyfin restart" | at now echo "sleep 2; /usr/bin/sudo $( which service ) jellyfin restart || /usr/bin/sudo $( which service ) jellyfin start" | at now
;; ;;
'sysv') 'sysv')
echo "sleep 2; /usr/bin/sudo /etc/init.d/jellyfin restart" | at now echo "sleep 2; /usr/bin/sudo /etc/init.d/jellyfin restart || /usr/bin/sudo /etc/init.d/jellyfin start" | at now
;; ;;
esac esac
exit 0 exit 0