Web Hosting Talk







View Full Version : cron to backup & email file


jdulberg
06-13-2001, 07:03 PM
Just wondering if anyone can suggest how I would go about setting up a cron tab to gzip a particular directory and email it to a specific address at x days of the month.

Any ideas are appreciated.

Fremont Servers
06-13-2001, 09:58 PM
Hello,

Why don't you use a commercial backup software?

Like
Lonetar.com

Originally posted by jdulberg
Just wondering if anyone can suggest how I would go about setting up a cron tab to gzip a particular directory and email it to a specific address at x days of the month.

Any ideas are appreciated.

Eagle_
06-13-2001, 10:55 PM
Do a "locate cron.daily"

You will be given a directory
Look around there, back that one up :D

DaveC#
06-14-2001, 11:22 AM
Although possible it would not be advisable to send email that is the size of backups.

2 steps for automated backup

1) Create a rolling backup script


#!/bin/bash
# Backup script: Make sure we use bash
# tar webroot
echo "Today is `date`"
echo ""
echo "Current Disk space Usuage"
echo ""
echo " `df -k`"
echo "Begin Backup"
echo ""
tar cf - /home/www/ | gzip -9 > /home/wwwbackups/backup.tar.gz
echo ""
echo "Backup completed"
echo "Disk space usuage after backup"
echo ""
echo "`df -k`"


2. Create an an automated ftp script

ftp -s:filename

ftp -s:filename

open mydomain.dom
user mylogon mypass
binary
cd /home/wwwbackups/
mget backup.tar.gz
bye