i set my crontab file, and crontab -l works, shows what i wrote… but my cron doesn’t run when it’s supposed to… is there something i’m missing, like enabling crons in my account or something?
Do the commands run when cut and pasted into the command line? Are you using full paths in your commands?
If that’s not it then show us your crontab file.
yes the commands run when pasted on command line verbatim, and no i’m not using full paths, i thought in dh case using ~ would fit better.
heres my crontab -l
59 23 * * * mysqldump -u username password host stuff | gzip >~/backup/dbBackup-
55 23 * * 6 tar -zcpf ~/backup/weeklySiteBackup-
date '+%Y-%B-%d'.tar.gz --directory …/mysite .
Use the full path for mysqldump, gzip, date, and tar
i get this error message in my email
/bin/sh: -c: line 1: unexpected EOF while looking for matching ``’
/bin/sh: -c: line 2: syntax error: unexpected end of file
i’m pretty sure it’s because i have backticks in my command, but i don’t know a workaround. i need my filenames like this
is there anyway to get those results?
your EOF isn’t necessarly a bad thing. Are the commands working as expected? if that’s the case then you can just ignore it. There’s info in the wiki on how to suppress this error message output.
Oh yeah, there’s some talk about keeping a blank line at the end of your crontab file. I don’t, but it seems to make a difference for some.
Another way around this may be to create a ~/bin directory with your command and then call that script from the crontab. Just guessing here now.
i did have a blank line at the end of my crontab (completely blank right? nothing written on the line?)
also, the cron does run if i don’t use this in the command
date '+%Y-%B-%d' so i think it’s the backticks` that are screwing things up, but i need them to have dated files, or is there another way?
Have you tried escaping your %'s with a \ (backslash) to stop the % symbols being treated as a newline command?
Or even enclosing the whole line in double quotes?
i used “double quotes” and it works fine! perfect! thanks so much…
hmmm… when it ran, i checked the backup directory and saw that it was there. but it didn’t email me this time. it usually does… with or without errors…
i guess thats ok i don’t NEED email notifications, but is there a way to do emails? or crons to send emails like to remind me to download the backups every month?
It will send the messages to root but I believe adding
mailto="email@example.com" should send cron runtime messages there.
You could add a cron line to a script which contains a mailto example.
… a line like
mail -s “Now is the time to download backups” firstname.lastname@example.org <message
Where message is a text file with some uhm …text.
cool i just echo “Download backups~!” | mail -s “download backups” email@example.com
works perfect, better than it was, thanks everyone for your helps
I’m being kinda slow. I just realized what your end goal is. You should look at the wiki article called automatic backups. I outline a process of creating mysql dumps, site backups, and then having your windows computer automatically download them.
Sorry for not pointing this out earlier, it might have made things simpler for you.
thanks i’ve found this http://wiki.dreamhost.com/index.php/Automatic_Backup
and i’ve gotten most of the steps already… but i’m not a windows user… i’m on gentoo linux.
so i can write a shell script instead of a batch file, but i’d rather handle the monthly backups personally… just cause i’d like them burnt and labeled, so i’d need a blank cd in the tray etc.
thanks for all the help. i truly appreciate it.