Hello there !
This is my crontab:
Code:
0,30 * * * * /etc/init.d/mc backup
0 4 * * * find /var/spool/clientmqueue -ctime 1 -exec rm -rf {} \;
10 4 * * * find /backup/minecraft.backup -ctime 1 -exec rm -f {} \;
20 4 * * * cd /backup/minecraft.backup/ && ls -lt * | head -1 | awk '{print "cp " $9 " /backup/minecraft.backup/daily/"$9}' | sh
#
Explanations:
Line 1 - backup script for game server
Line 2 - empty useless files on OS
Line 3 - deleting backups older than a day from /backup/minecraft.backup
Line 4 - copying to another folder the newest file from /backup/minecraft.backup, in order to have something like folder 1 with the 30 min. backups from the last day, folder 2 with a file from each day, for a week span and so on, so that I can choose older backups if I need to, without having a lot of space occupied.
The weird thing is as follows: the last command is supposed to copy the latest file from /backup/minecraft.backup/ to the daily subfolder AND JUST THAT. And that's what it really does if I run it manually. However, if it runs automatically through crontab, it also deletes files older than a day from the
daily subfolder. That is not what I want, I just want it to copy files there
without deleting. Funny thing is that I tried running all the commands manually, in the same order as they're in the crontab, and that doesn't delete anything, so it only happens when it runs automatically through crontab.
Anybody knows what's going on here?