BlueRey

auto-restart after crash - linux cron

Oct 12th, 2019
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.28 KB | None | 0 0
  1. #!/bin/bash
  2. sampdir="/home/samp/"
  3. process=`ps u -C samp03svr | grep -vc USER`
  4.  
  5. if [ $process -eq 0 ]; then
  6.     echo $(date +"[%d/%m/%Y %H:%M]") sa-mp server not running, restarting it. >> backups/autorestart.log
  7.     cd "$sampdir"
  8.     ./samp03svr &
  9. else
  10.     echo sa-mp server already running
  11. fi
Advertisement
Add Comment
Please, Sign In to add comment