Print Topic - Archive
E-Blah Community / Chit - Chat / cron job
Posted by: threewishes, January 29, 2010, 3:35pm
Can someone tell me what command would be to run a cron job to d/l the forum data daily?
Posted by: evixion, January 30, 2010, 12:33pm; Reply: 1
I had to write a script that would tar up the cgi-bin and blahdocs. Then I put that script into the cronjob. I was thinking about writing an autobackup script for E-Blah but I'm still a novice :P
If it helps, I can send you my bash script and maybe it can assist you.
Posted by: threewishes, January 30, 2010, 2:44pm; Reply: 2
autobackup script for E-Blah is what Im looking for :)
If someone can help us out :)
Posted by: evixion, February 6, 2010, 5:25pm; Reply: 3
Ok, bear with me but this is what I have as an auto-backup script
Save this file in your shell account as whatever_your_domain_is_backup.sh
You will also need to edit the first few lines to point to the correct directory (and you may need to make the backupdir directory). Also I made my script e-mail me every time a backup is performed so you will need to edit the
[email protected] to point to your e-mail address.
|
Code
#!/bin/bash
sourcedir=/full/path/to/your/forums/cgi-bin
backupdir=~/eblahforumbackup/
haltfile=~/eblahforumbackup/.halt
datedir=`date +%Y/%m-%B/`
if [ ! -f $haltfile ] ; then
touch $haltfile
cd $sourcedir
if [ ! -d ${backupdir}${datedir} ] ; then
mkdir -p ${backupdir}${datedir}
fi
tar -cjf "${backupdir}${datedir}forums-`date +%m-%d-%y.%H-%M-%S`.tar.bz2" .
echo "A daily backup was made of the Your Forum database ${sourcedir}. The file can be found at: ${backupdir}${datedir}gaforums-`date +%m-%d-%y.%H-%M-%S`.tar.bz2" | mail -s "Daily Backup Report" youremail@domain.com
find $backupdir -type f -mtime +30 -exec rm {} \;
find $backupdir -type d -print0 | xargs -0 rmdir --ignore-fail-on-non-empty --parents
rm -f $haltfile
fi
|
|
This code will tar your forum folder if configured correctly. It will also delete any backup that is older than 30 days.
Let me know if I can be of further assistance :)
Print page generated: February 12, 2012, 2:51pm