Advertisement
Guest User

Untitled

a guest
Jan 21st, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. BACKUP_DIR=/home/steam/backup
  2. CURRENT_HOUR=$(date +"%H")
  3. CURRENT_DATE=$(date +"%F_%H")
  4. SERVER_PROCESS=$(ps axf | grep arma3server | grep -v grep)
  5. # CHECK SERVER IS RUNNING
  6. echo_time() {
  7. date +"%H:%M $(printf "%s " "$@" | sed 's/%/%%/g')"
  8. }
  9. while [ ! -z "$SERVER_PROCESS" ]; do
  10. sleep 5
  11. echo_time "The server is still running!" >> restart.log
  12. SERVER_PROCESS=$(ps axf | grep arma3server | grep -v grep)
  13. done
  14. echo_time "The server is offline, the script is now started."
  15. # CHECK THE TIME FOR A BACKUP
  16. if [ "$CURRENT_HOUR" -eq 00 ] || [ "$CURRENT_HOUR" -eq 12 ]; then
  17. # ITS TIME FOR A BACKUP
  18. echo_time "A backup is created." >> restart.log
  19. mysqldump --user=root --password=alexm165 exile > $BACKUP_DIR/db_$CURRENT_DATE.sql
  20. zip -r $BACKUP_DIR/bu_$CURRENT_DATE.zip /home/steam/arma3/battleye /home/steam/arma3/mpmissions /home/steam/arma3/@ExileServer
  21. #BACKUP COMPLETE NOW RESTART THE SERVER
  22. ./arma3server -cfg=@ExileServer/basic.cfg -config=@ExileServer/config.cfg -autoinit -mod=@Exile\;@dino\;@ryanzombies\;@cba3\;@cupsu\;@cupsw\;@cupv\;@ebm -servermod=@ExileServer\; >> serverlog.rpt
  23. echo_time "Backup was created successfully, the server is now restarted." >> restart.log
  24. else
  25. # ITS NOT TIME FOR A BACKUP JUST RESTART
  26. echo_time "No backup is performed. The server is restarted." >> restart.log
  27. ./arma3server -cfg=@ExileServer/basic.cfg -config=@ExileServer/config.cfg -autoinit -mod=@Exile\;@dino\;@ryanzombies\;@cba3\;@cupsu\;@cupsw\;@cupv\;@ebm -servermod=@ExileServer\; >> serverlog.rpt
  28. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement