Cron tab newbie

hello folks. ive read the dreamhost wiki on crontab and man am i lost! ive never used it before tho i have used the shell using putty. id like to learn the basics at best but right now all i want to do is what i tholt would be a simple file move copy for a few files replacing another.

example lets say i have a file called footer.html and i want it to change on a certain day of the week for a special ocasion or such. so how would i go about doing say…

monday footer.html.monday > footer.html
tuesday footer.html.tuesday > footer.html


and is there a crontap for dummies tutorial online some where?

crontab itself goes according to minutes, hours, days, months, and years. It does not know monday or tuesday.

To achieve your goal, you may want to try to write a PHP or Perl script to update the files according to monday or tuesday. And crontab job will run the script everyday.

$50 off and 3 free domains with code: [color=#CC0000]DH3[/color] Sign Up NOW or More Codes Here

way over my head… ok so lets say i just want to change it for a holiday?

If you want to start using Cron, then you’ll have to know some shell scripting:

But your crontab file should look something like:
1 0 * * 0 /bin/cp -f ~/footers/sunday.html ~/
1 0 * * 1 /bin/cp -f ~/footers/monday.html ~/
1 0 * * 2 /bin/cp -f ~/footers/tuesday.html ~/
(at 1 after Midnight, on Sundays/Mondays/Tuesdays regardless of day of month and month, force copy the sunday/monday/tuesday footer)

2 0 25 12 * /bin/cp -f ~/footers/christmas.html ~/
(at 2 after midnight on Day 25, Month 12, regardless of day of week, force copy the Christmas footer)


ah! thank you, now i can start to learn with cron. quick question however, if i “mess up” in cron will it cause issues for others on the server or on my own account? i dont want to do anything that would adversely affect other users.

It will only cause issues if the command you’re using overloads the server, which is unlikely. You’re just using basic UNIX commands which will run very briefly. Should it run for some extended period of time, an automated bot will kill it.


Just be careful not to have your jobs (inadvertently) performing intensive operations too often.

Don’t have it backing up a 200MB database every 7 seconds instead of every 7 days, etc.

Maximum Cash Discount on any plan with MAXCASH