PDA

View Full Version : sendmail question


WildWayz
Mon 19th Feb '01, 7:38pm
Hi ya

Do you know of a way I can set up a cron job so it runs a particular file that does this...
backs up MySQL data
tars then gzips it
emails it to me.

I can do the backing up and tar/gzipping, but I don't know how to get Sendmail to send me the email, plus attachment to me.

Sooooooo is there a command-line option to sendmail that I could use?

Or is there another way I can do this?

Ta

James

Dave#
Tue 20th Feb '01, 8:45am
cron should email you what it did unless you are pointing the output to dev null:

That is assuming your root

WildWayz
Tue 20th Feb '01, 9:12am
thats not entirely what I want it to do :)

I want it to make the backup, then email me the backup every day :)

Not make the backup then email me it when it is done :)

James

Dave#
Tue 20th Feb '01, 9:58am
oops- my bad- I din't read your email properly:

An easier way would be to run an ftp script to ftp to your server from your home PC/Workstation:


open <hostname or ip address>
user xxx yyy
prompt off
cd <directory> -> Change a directory on a remote system.
lcd <directory> -> Change a directory on a local system.
binary
mget filename
bye

Mitrofan
Tue 20th Feb '01, 11:31am
Do you want to recieve the backup file as an email attachment? That could be 100Mb file on a busy forum.

The better way it to use a cron to ftp into another server and upload your backup to it.

WildWayz
Tue 20th Feb '01, 11:39am
At the moment, the backup is about 5mb - when tar/gzipped it is 500k :)

Hmmm how would I make an FTP script then?

James

dwh
Wed 21st Feb '01, 1:00am
I've set up an automated ftp from cron on an ny server before. If you type i think it was either ftp /? or ftp -help or something like that, it will give you options like -s which points to a script file where you can automate the ftp. I think I tried it on a Sun server but didn't work becuz sun implementation didn't support ftp -s. Dunno about Linux..


Anyone else care to chime in?

Dave#
Thu 22nd Feb '01, 6:47am
ftp -s:filename

where filename is a file containing

open mydomain.dom
user mylogon mypass
binary
cd /usr/dumpdirectory
mget sqldump.file
bye

You will need to automate this. In NT use AT scheduler on win 95/98 you may need to download a scheduler from cnet or someother software site.


<EDIT>

Actually if that sounds convoluted there are shareware tools that can automate this process:

http://download.cnet.com/downloads/0-10106-100-2136804.html?tag=st.dl.10001-103-1.lst-7-5.2136804

dwh
Thu 22nd Feb '01, 2:47pm
Originally posted by Dave#
ftp -s:filename


yup, that's exactly what I did, but I thot it doesn't work for Unix. cool.