I have a script called backup.sh
:
#!/bin/bash
sudo zip -r /home/jazuly/backup.zip /var/lib/automysqlbackup/
cd /home/jazuly/backupscript/cp2google/
php cp2google.php /home/jazuly/backup.zip
cd ~
rm -f /home/jazuly/backup.zip
I made it executable:
sudo chmod +x backup.sh
Then I tried to edit cron
with crontab -e
.
I add:
# m h dom mon dow command
0 0 * * * /home/jazuly/backup.sh
but when cron
sends the backup.zip to my email, I download and open it, and the file is corrupt.
If I run the script manually with:
$ sudo chmod +x backup.sh
$ ./backup.sh
I can open the zip file.
/home/jazuly/backup.zip
as root (sudo
) and then try to delete it as a regular user (rm -f /home/jazuly/backup.zip
), that doesn't make sense.whereis -b zip