Hey Everyone,

Shell programming is something I haven't learnt or tried before.. but I kind of need it to automate backing up my website.

At the moment, I have:

#/bin/bash
/bin/tar czPf /home/cpanelusername/etc/files/wp-content-weekly.tar.gz /home/cpanelusername/public_html/wp-content/

but how do I get it to email me the file wp-content-weekly.tar.gz and then delete it?

Is that possible?

Thanks for ur help in advance

Sending email with attachments is difficult unless you use perl, python or some other script language, or if you have mpack or mmencode. Much easier to send an email mentioning the presence of the tarball and letting you interactively get it (yeah, not much fun). You could also do this as a "pull" operation from a machine where you would have stored the email (using ftp, scp, curl or whatever). That script should run as a cron job, could also notify you if the tarball was absent, small, or had incorrect timestamp, etc.

That possible. Use SendEmail.pl
http://caspian.dotconf.net/menu/Software/SendEmail/

it helped me a lot.
E.g.

sendEmail.pl -a myfile.zip -t my@email -f root@domain.xyz -u 'attached email'

Serge

Hey Everyone,

Shell programming is something I haven't learnt or tried before.. but I kind of need it to automate backing up my website.

At the moment, I have:

#/bin/bash
/bin/tar czPf /home/cpanelusername/etc/files/wp-content-weekly.tar.gz /home/cpanelusername/public_html/wp-content/

but how do I get it to email me the file wp-content-weekly.tar.gz and then delete it?

Is that possible?

Thanks for ur help in advance

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.