Hi, I am somewhat suck on how to do this for a custom game server that I am attempting to setup on a VPS.
Basically since this custom game server is utilizing SQlite3 I obviously cannot just “compress and go” with the game’s directory. So I am thinking it may be easier to do the following automatically…
- Shut down the systemd service (the custom game server process) to halt everything therefore making the SQlite3 databases “safe” to backup now.
- Compress the game’s directory
- Bring the game server back online with the systemd service
- Transfer the compressed archive
- Rinse and repeat
Rather than paying someone a small fortune for specifically for “hot” backing up with the backup API.
So I found a guide for automatic backups How to automatically backup files and directories in Linux | ADMFactory …
#!/bin/bash TIME=`date +%b-%d-%y` # This Command will read the date. FILENAME=backup-admfactory-$TIME.tar.gz # The filename including the date. SRCDIR=/var/www/html # Source backup folder. DESDIR=/backup # Destination of backup file. tar -cpzf $DESDIR/$FILENAME $SRCDIR
Though I am obviously still a long way from completing everything that needed. Because I am mainly stuck on how to…
- Stop and start the process back up only when the game process have actually stopped and compressing been completed respectively. To ensure no damages can occur to the databases.
- Transferring the now compressed achieve to remote storage on another network. Then deleting the achieve if successful.
Is it possible to easily setup such a script to do the above safety? Or what is recommended to automate backing up and transferring safety?
Thanks very much in advance.