Untitled
Vrunerunknown
plain_text
13 days ago
1.2 kB
0
Indexable
Never
Daca tot am trecut pe aici, hai sa va las cel mai simplu "vrunner" posibil 🙂 Output-ul daca rulati direct va fi ceva de genul , iar shell-ul suna cam asa: ```shell #!/bin/sh # Simple auto-check/start script by [RaffaeL] # The script only checks the PIDs without executing any command untill, # if by any chance any core goes down it'll be restarted. #Can be used within a cronjob(crontab) on let's say...30 minute as follows: #/etc/crontab #check the process pids and start it if it's down #minute hour mday month wday who command # #*/30 * * * * root /path/to/your script/checkpid.sh # gamePath="/usr/metin2/server" if [ ! -d "$gamePath" ]; then echo "$gamePath directory doesn't exist!" exit 1 fi check_and_restart() { cd "$1" process="$2" if pgrep -f "$process" >/dev/null; then echo "$process is running" else echo "$process stopped" ./$process && sleep 5 #mail fi } check_and_restart "$gamePath/db" "db" check_and_restart "$gamePath/auth" "auth" check_and_restart "$gamePath/channel1/first" "game" check_and_restart "$gamePath/game99" "game" ``` 😉
Leave a Comment