You are not logged in.
Pages: 1
That's my first post, so I want to say 'Hello'.
I've got a big problem, firstly, i should say that i'm completely newbie (so lame ).
OK, let's start. I've installed a server (Apache) on Archlinux, now, I want to do backups once a week. How can I do that.
I want:
1)backup all files in /home/httpd
2)backup all databases (mysql)
All backups should be send on my mail.
How can i do that?
Thanks in advance
btw, sorry for my english, but i'm from Poland and i don't speak english much (so could u answer in "simply english"? )
Last edited by /etc/passwd/ (2008-04-17 17:20:22)
Offline
You've probably got the whole crontab thing right.
To start with I'd suggest you make a small shellscript that you run via cron..
Something like this:
#!/bin/bash
$HTTP="/path/to/httpd/dir"
$MYSQLUSER="username" #This needs to be a privileged user that has access to all databases.
$MYSQLPASS="password"
$MYSQLDUMP="name-of-mysql-backup-file"
$BACKUPDIR="/path/to/a/backup/dir"
$DATE=`date '+%y-%m-%d'`
cp -Rp $HTTP $BACKUPDIR/httpd
mysqldump --all-databases -u $MYSQLUSER -p"$MYSQLPASS" > $MYSQLDUMP
tar jcf backup-$DATE.tar.bz2 $BACKUPDIR
This script should do the backup for you, and pack it up into a nice little tarball with a datestamp for easy access in the future.
All you need to do now is the crontab part.
Run:
crontab -e
As VI is the usual editor you press either I or insert to enter editing mode.
Depending on when you want it to run you will need to modify this example line:
0 3 * * 6 /path/to/your/script.sh
This line says that it will run at 3:00AM on the 6th day off the week. Hence 3:00AM Saturday morning.
Unfortunatley I do not have a prefered way of mailing backups to me, but I would suggest you read up on Sendmail and try to modify the script accordingly!
Good luck!
Edit: Oh, forgot to mention how you get the mysqlbackup back into the database...
mysql -u username -p < filename
Last edited by _nalle (2008-04-16 17:16:52)
Swedish Archlinux Mirror Administrator - ftp.gigabit.nu
Offline
Solved
Thanks a lot
Offline
Pages: 1