Skeptical
03-02-2003, 02:03 AM
I'd like to set up a shell script to back up my files and then send to me via email. How do you go about doing this?
![]() | View Full Version : Send file to email Skeptical 03-02-2003, 02:03 AM I'd like to set up a shell script to back up my files and then send to me via email. How do you go about doing this? serial 03-02-2003, 03:28 AM This should work for you. Modify it to your liking: #!/bin/sh tar=/bin/tar uuencode=/usr/bin/uuencode mail=/bin/mail backupdir=/backup/autobackups emailbackup="y" subject="Backup" mailto="user@domain.com" mkdir -p ${backupdir} if [ ! -d ${backupdir} ] then exit 1 fi $tar zcvf ${backupdir}/home.tar.gz /home $uuencode ${backupdir}/home.tar.gz home.tar.gz > ${backupdir}/home.tar.gz.uu if [ $emailbackup = "y" ] then $mail -s "$subject" $mailto < ${backupdir}/home.tar.gz.uu fi rm -f ${backupdir}/* exit modihost 03-02-2003, 05:50 AM i made this in like 10-20 mins using the phpmailer class unzip, chmod 755 email.php, then edit the config options in email.php then set a crond job to run email.php every day/night this will make a backup of a file or directory and then email it to you a an attachment |