Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BACKUP_DIR=/home/steam/backup
- CURRENT_HOUR=$(date +"%H")
- CURRENT_DATE=$(date +"%F_%H")
- SERVER_PROCESS=$(ps axf | grep arma3server | grep -v grep)
- # CHECK SERVER IS RUNNING
- echo_time() {
- date +"%H:%M $(printf "%s " "$@" | sed 's/%/%%/g')"
- }
- while [ ! -z "$SERVER_PROCESS" ]; do
- sleep 5
- echo_time "The server is still running!" >> restart.log
- SERVER_PROCESS=$(ps axf | grep arma3server | grep -v grep)
- done
- echo_time "The server is offline, the script is now started."
- # CHECK THE TIME FOR A BACKUP
- if [ "$CURRENT_HOUR" -eq 00 ] || [ "$CURRENT_HOUR" -eq 12 ]; then
- # ITS TIME FOR A BACKUP
- echo_time "A backup is created." >> restart.log
- mysqldump --user=root --password=alexm165 exile > $BACKUP_DIR/db_$CURRENT_DATE.sql
- zip -r $BACKUP_DIR/bu_$CURRENT_DATE.zip /home/steam/arma3/battleye /home/steam/arma3/mpmissions /home/steam/arma3/@ExileServer
- #BACKUP COMPLETE NOW RESTART THE SERVER
- ./arma3server -cfg=@ExileServer/basic.cfg -config=@ExileServer/config.cfg -autoinit -mod=@Exile\;@dino\;@ryanzombies\;@cba3\;@cupsu\;@cupsw\;@cupv\;@ebm -servermod=@ExileServer\; >> serverlog.rpt
- echo_time "Backup was created successfully, the server is now restarted." >> restart.log
- else
- # ITS NOT TIME FOR A BACKUP JUST RESTART
- echo_time "No backup is performed. The server is restarted." >> restart.log
- ./arma3server -cfg=@ExileServer/basic.cfg -config=@ExileServer/config.cfg -autoinit -mod=@Exile\;@dino\;@ryanzombies\;@cba3\;@cupsu\;@cupsw\;@cupv\;@ebm -servermod=@ExileServer\; >> serverlog.rpt
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement