I have an indexer for sphinx, and i want it to run once every hour in linux. How would i do this?

link|improve this question
feedback

migrated from stackoverflow.com May 9 '10 at 22:33

This question came from our site for professional and enthusiast programmers.

8 Answers

cron.

link|improve this answer
and use crontab to edit the crontab file ... see crontabrocks.org for a nice intro – Doug Harris May 10 '10 at 1:56
feedback

Use crontab.

link|improve this answer
feedback

Since everyone else is posting short answers, I thought I'd be a little more dscriptive...

cron is a daemon found on most *nix systems that runs scheduled commands at the specified intervals.

You add a script to the list by copying it to the folder of your choice:

  • cron.daily
  • cron.hourly
  • cron.monthly
  • cron.weekly

These folders are typically fount in /etc.

link|improve this answer
1  
cron.* folders are very much distro specific. crontab is the universal way of having items run by cron at specified intervals. – MDMarra May 9 '10 at 22:51
True. I'm just giving an example. crontab gives you much more control anyway. – George Edison May 9 '10 at 22:55
feedback

Just to be different -

depending on your needs you could use the watch command.

  watch --interval=3600 command
link|improve this answer
feedback

With the cron utility

link|improve this answer
feedback

That's what cron is for.

link|improve this answer
feedback

If you just need it once in a while, not permanently like you get with cron, and the watch solution isn't flexible enough, you can also use good old bash scripting:

while true; do
   # do stuff
   sleep $[60 * 60]
done
link|improve this answer
feedback

Your Answer

 
or
required, but never shown