Firstly here is the script that I am running into issues for my custom game server.
for db in map players; do
sqlite3 $db.sqlite “.timeout 1000” “.backup $db-backup_
#moves backuped sqlites
mv -backup_.sqlite /home/user/backups
#backup the file based contents
tar czf /home/user/backups/world_
date '+%m-%d-%Y'.tar.gz -->exclude=’.sqlite’ *
This is located where it should be and both manual and Cron Job operations creates a few issues…
- Should the game server be active (exploring in map) the backups get totally screwed up since for some reason the .backup command doesn’t cope with this well??
- File sizes for the databases are just a few kbs when they are as much as 3xxMB in size currently and the other still being xxkbs in size!
- Tar.gz also backs itself up (so it does ~/backup/own.tar.gz instead of the files in the bash’s current directory).
- I get “0 bytes” sqlites in a parent directory as well.
The only “error” I was able to get out of running it manually while auto walking in the server was
“tar: map.sqlite-journal: file changed as we read it”
Even though as shown above I “excluded” it and other DBs using the wildcards from the tarring processing. As the Sqlite3 .backup commands were supposed to deal with the data base backing up instead as commented. Honestly I am not sure WHY this is the case when the game server is active enough to flip it out of the control.
Anyone able to help me troubleshoot my backup script to not to be so messed up like this?