:: [DNG] How to check and restart Emby…
Góra strony
Delete this message
Reply to this message
Autor: Mario Marietto
Data:  
Dla: Mario Marietto via Dng
Temat: [DNG] How to check and restart Emby server on Devuan 5 as soon as it closes.
Hello to everyone.

I'm trying to keep up one Emby server on my ARM Chromebook arm 32 bit aka
SNOW. The real problem is that it is able to be up only for some time and
then closes. To fix this problem,I've created a couple of bash scripts that
act as a sentinel. As soon as it goes down,they detect it and they try to
restart the process. I created 3 bash scripts that should do the trick :

1) check-emby

while :
do
 if pgrep Emby > /dev/null
 then
     echo "Emby is running..."
     sleep 10s
 else
     echo "Emby is not running...but now it will run again"
     /opt/emby-server/bin/./emby-server &
 fi
done


2) check-check-emby

while :
do
 if pgrep Emby > /dev/null
 then
     echo "Emby is running..."
     sleep 10s
 else
     echo "Emby is not running...but now it will run again"
     /opt/emby-server/bin/./check-emby &
 fi
done


This is what happens when "emby-server &" is invoked :

# ps ax | grep emby

9202 pts/1    Sl+    1:06 /opt/emby-server/system/EmbyServer -programdata
/var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg
/opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe
-restartexitcode 3 -updatepackage emby-server-deb_{version}_armhf.deb



I had to create two bash scripts because when EmbyServer stops working,even
check-emby closes. I don't understand why. Inside my sick mind the
check-check-emby script should restart both. I don't know if it will work.
For the moment it is still up and running.


Well. I have a couple of questions to ask you :


1) Can you imagine a better method than mine to achieve the same goal ?

2) Do you think that it will work ?

3) When Emby closes I would like to hear a beep coming from the Chromebook
and I would like the beep to be produced by the bash script.

Can you help me ? thanks.

--
Mario.