hi, i'm a newbie to freebsd. I have installed FreeBSD 7.2 in my VirtualBox. Right now i want cron to perform a simple backup everyday and name the folder backup_todayDate .
Since i'm a newbie to Unix & i have no idea how to write a script, i simply follow the tutorial here:
http://www.pixel2life.com/publish/tutorials/600/bash_scripting_backup_script/page7/
Then, i edit my /etc/crontab file with these configuration
since i want to play around with cron first, i want to set it to execute the script every 1 min at first.
This is the edited script (credit to Matthew Brunt):
Unfortunately, if I execute the command:
# crontab backupscript
it outputs:
i have also googled "bad minute error in crontab" but unfortunately, after i have skimmed through 3 pages of searches, i gave up. I think it's useless to google if the problem lies with the script itself.
any help for this newbie will be appreciated. thanks.
Since i'm a newbie to Unix & i have no idea how to write a script, i simply follow the tutorial here:
http://www.pixel2life.com/publish/tutorials/600/bash_scripting_backup_script/page7/
Then, i edit my /etc/crontab file with these configuration
Code:
*/1 * * * * root /usr/home/hisyam/backupscript
since i want to play around with cron first, i want to set it to execute the script every 1 min at first.
This is the edited script (credit to Matthew Brunt):
Code:
#!/bin/sh
OUTPUT=/BACKUP/backup_$(date +%Y%m%d).tgz
BUDIR="/usr/local/www/ntah/"
echo "Starting backup of directory $BUDIR to file $OUTPUT"
tar -czf $OUTPUT $BUDIR
if [ $? == 0 ]; then
echo "The file:"
echo $OUTPUT
echo "was created as a backup for:"
echo $BUDIR
else
echo "There was a problem creating:"
echo $OUTPUT
echo "as a backup for:"
echo $BUDIR
fi
Unfortunately, if I execute the command:
# crontab backupscript
it outputs:
Code:
"backupscript":3: bad minute
crontab: errors in crontab file, can't install
i have also googled "bad minute error in crontab" but unfortunately, after i have skimmed through 3 pages of searches, i gave up. I think it's useless to google if the problem lies with the script itself.
any help for this newbie will be appreciated. thanks.