Hello,
I am trying to write a cron job script that would temporarily archive my data, mail them to me, and then delete what ever archive created:
The script doesn't work, and without a terminal, I have no idea what is wrong with it. I plan to run it monthly, but for testing purpose, I am making it run daily right now:
Any help?
I am trying to write a cron job script that would temporarily archive my data, mail them to me, and then delete what ever archive created:
Code:
#!/bin/bash
#Make an archive of public_html
tar czf ~/backups/backup/html.tgz ~/public_html
#Make a back up of SQL database
mysqldump --opt -Q -u database_user --password='password' database_name | gzip > ~/backups/backup/SQL.gz
#Put them both in a nice package
tar czf ~/backups/backup.tgz ~/backups/backup
#mail it to me
mutt -a ~/backups/backup.tgz -s "File attached" -- email@address.com
#delete all files created
rm -rf ~/backups/*
The script doesn't work, and without a terminal, I have no idea what is wrong with it. I plan to run it monthly, but for testing purpose, I am making it run daily right now:
Any help?