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.

How do i add 2 cron for Fedora ami in AWS, where i need to run one cron twice a day and other one would be if data is added to the DB.

Pleas guide me from the begging coz this cron concept and the handling it is new for me

share|improve this question

closed as not a real question by Shane Madden, Michael Hampton, kce, mdpc, Khaled Jan 31 '13 at 7:42

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

For the first task, enter crontab -e and add following line in the editor:

0 0,12 * * * /path/to/script >/path/to/output.log 2>&1

so the script it run at 00:00 and 12:00.

For the second case, remember that cron is a scheduler. You need to know what time to run it at. So basically you cannot cron it unless you know exact time when it should run. If you do, add it like in my example as a second line.

See more about crontab syntax for example from here: http://www.manpagez.com/man/5/crontab/

I would suggest looking at this blog post too which should get you up to speed quickly with the concepts around cron and how it works.

share|improve this answer
    
Hi thanks for the reply, How do u I run PHP url in the cron do i have to use 'wget', if so how would i use from my scenario –  fafy Jan 31 '13 at 5:40
1  
Hi, this was a generic answer to add a script to cron. Please file a new question if you need help in creating a script for your case. –  grassroot Jan 31 '13 at 6:42
    
Thank you very much for the support this gave me a good idea to start plus thesitewizard.com/general/set-cron-job.shtml this link gave me clear idea about cron and step by step instruction –  fafy Jan 31 '13 at 7:00

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