Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a app that fetches some feeds, is there a way i can get it to be done every 30 minutes?

(i've not installed a graphical desktop, so a terminal fix would be loveable :D)

share|improve this question
add comment

4 Answers

up vote 10 down vote accepted

Use your crontab:

crontab -e

Then enter a line like the following

*/30 * * * * /path/to/your/command

Save it and it should run every 30 minutes of every hour, every day.

Updated the 30 minutes part, was being too quick. Thanks @nicolas, you got a +1.

share|improve this answer
    
when i type crontab -e, am i suppose to open the file /tmp/crontab.DYFYJ1"? –  Jason94 Jun 9 '11 at 9:52
    
Yes, this is normal behavior. The crontab command will take care of it. From the manpage: "After you exit from the editor, the modified crontab will be installed automatically." –  slhck Jun 9 '11 at 9:54
    
is there a way to test crontab? –  Jason94 Jun 9 '11 at 9:56
    
Call crontab -l to list your current crontab entries. –  slhck Jun 9 '11 at 9:57
    
@Jason94: To test crontabs, I usually copy the entry and edit the time to run in the next minute. –  Zan Lynx Jun 9 '11 at 14:25
add comment

Cron sounds like what you're looking for.

Log in as the user you want the task to be ran by, then type "crontab -e"

Your favorite editor will open, and you will get a file with this format :

    # m h  dom mon dow   command

So to run '/home/foo/my_program' every 30min, you would add this line

    */30  *  * * * /home/foo/my_program > /dev/null

/dev/null is there so you do not get the output sent by mail if your program writes something to stdout.

share|improve this answer
4  
By the way */30 means every 30 minutes while 30 means "every time the clock hits 30mins (0h30, 1h30, 2h30...) which would cause the task to be ran each HOUR instead of every 30 mins. –  Nicolas Jun 9 '11 at 9:41
add comment

This sounds exactly like a job for cron. This is a good howto use it, yes it's for ubuntu and you're using fedora, but as far as I'm aware there are no differences between the two regarding cron.

share|improve this answer
add comment

Use cron to run it periodically.

From the account of the user you wish to run the script:

crontab -e

Then add a new line as follows:

*/30 * * * *  <path/to/script>

Then save the crontab, which will automatically install it. The job will then run every 30 minutes and email you any output.

share|improve this answer
add comment

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.