implement timeout restarter script
This commit is contained in:
parent
b6969f8d22
commit
adea80a11b
24
bin/prod/timeout-restarter
Executable file
24
bin/prod/timeout-restarter
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
source bin/lilarc
|
||||
|
||||
URL=$PROD_URL
|
||||
TIMEOUT=5 # Restart if it takes longer than that
|
||||
DELAY=20 # Check every delay
|
||||
MSG="Connect to $URL in less than $TIMEOUT seconds"
|
||||
|
||||
lilalog "Start timeout restarter"
|
||||
|
||||
while true; do
|
||||
|
||||
sleep $DELAY
|
||||
|
||||
curl $URL --max-time $TIMEOUT -so /dev/null
|
||||
|
||||
if [ $? = 0 ]; then
|
||||
lilalog "SUCCESS $MSG"
|
||||
else
|
||||
lilalog "FAIL $MSG"
|
||||
bin/prod/restart
|
||||
fi
|
||||
|
||||
done
|
Loading…
Reference in a new issue