Jump to content

Recommended Posts

Posted

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?

Posted

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.

Posted
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?

Posted (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 by Jimuni

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...