Compare commits

...

2 Commits

Author SHA1 Message Date
4c7716a913
fixed missing /tmp/ 2023-02-14 20:41:31 +01:00
c9faefa42c
added an lock file to exit restarter if restart is already triggered
If you want multiple conditions (if ping is sucessfull, on less than X CPU Usage etc) for the restarter, it will create a lock file now to avoid multiple instances.
2023-02-14 20:36:17 +01:00

View File

@ -7,6 +7,14 @@ containername=ebesucher
# Variable für die Maximale Nutzung von CPU Cores # Variable für die Maximale Nutzung von CPU Cores
CPUcores= CPUcores=
# Überprüfe ob bereits ein restart läuft
if [ -f /tmp/ebesucher_restart.lock ]; then
exit
fi
# Erstelle Lockfile
echo $$ > /tmp/ebesucher_restart.lock
# Ordner des Skripts # Ordner des Skripts
git_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) git_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
# Wechsel in den Ordner # Wechsel in den Ordner
@ -41,3 +49,4 @@ elif [[ $ram_avail -ge "5" ]]; then
docker_run "4g" "$CPUSet" docker_run "4g" "$CPUSet"
fi fi
rm -f /tmp/ebesucher_restart.lock