editor Posted February 18, 2006 Posted February 18, 2006 I'm running a cron job that backs up a single directory every night. It looks like this: tar -czvf /home2/******/backup.tar.gz /home2/******/data/board/users Each time it runs it sends an e-mail that lists the files in the "users" directory that have been compressed into the tar file. Is there a way to change the cron job so that the actual backup.tar.gz file is e-mailed to me each night instead of the list? Quote
TCH-Andy Posted February 18, 2006 Posted February 18, 2006 Hi, You would need to do it in a script, such as php, then run the script via the cron job. I'm not aware of a way to do it directly on the cron line. Quote
editor Posted February 18, 2006 Author Posted February 18, 2006 You would need to do it in a script, such as php, then run the script via the cron job. Thanks for the advice. I don't know perl or php well enough to write such a script from scratch. I've just spent more than an hour searching the Internet via Google as well as looking as sites like Hotscripts but can't seem to locate anything suitable. I've found scripts like dbsender and backup2mail but they're designed to work with MySQL databases. I'm dealing with a single file (which would probably require a much simpler script). Does anyone know of a script that will work for me? Quote
TCH-JimE Posted February 20, 2006 Posted February 20, 2006 (edited) Hello, Try this link. The first part talks about dumping and taring of a mysql database. However, further down there is a perl scrip to send this attachment to an email address. I am sure it can be changed to email your file instead. http://www.cgi-interactive-uk.com/mysql_dump.html However, mime:lite is not installed so you will need to change it slightly to use I think the smtp version, check in your cpanel then perl modules and look for i think smtp. Then look up how that needs to be done and you should be in buisness. However, if you wish to use PHP, goto this link: http://www.sematopia.com/upload/dbBackUp/dbBackUp.php.txt Ok, so again its a DB backup, but you can edit the line which backs up the database to say copy your tar to the backup place and then just have it mailed to you. Jimuni Edited February 20, 2006 by Jimuni Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.