Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I added two lines to my crontab:

0,4,1,* * * * * /srv/vhostsbackup.sh

30,4,1,* * * * * /srv/dbbackup.sh

Both sh should be executed one time at the first day of a month. Would they work?

share|improve this question
    
Numbers separated by commas will stay in the same column. So your first line says to run the command at 0 minutes, 4 minutes, 1 minutes, and every minute; every hour; every day (of the month); every month; every day (of the week). –  Chris S Apr 6 '10 at 21:56

3 Answers 3

up vote 2 down vote accepted

I don't think they will work properly. You need to replace the asterisks with your numbers, and don't separate them with commas.

This will run at 4am on the first of each month:

0 4 1 * * /srv/vhostsbackup.sh

This will run at 4:30am on the first of each month:

30 4 1 * * /srv/dbbackup.sh

Good luck,

--jed

share|improve this answer

No - you've got too many asterisks and commas there.

For executing once on the first day of the month, you want something like

0 8 1 * * /srv/vhostsbackup.sh

That will run at 8AM on the 1st of each month.

share|improve this answer

Add this comment line on your crontab :

# m h dom mon dow user  command

(or without user if you are not on a Debian/Ubuntu plateform). Then you will see that you don't have the good number of parameters.

Of course, check your logs. With your line, I have :

Error: bad command; while reading /etc/crontab
share|improve this answer
1  
This works for the crontab in /etc, for a user's contrab, leave out the 'user' column. –  Chris S Apr 6 '10 at 21:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.