LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How can I get crontab to execute process every 10 minutes? (https://www.linuxquestions.org/questions/linux-newbie-8/how-can-i-get-crontab-to-execute-process-every-10-minutes-859710/)

keevill 01-31-2011 03:29 AM

How can I get crontab to execute process every 10 minutes?
 
I am trying to get a process ( SARG access log report tool ) to run every 10 minutes but I cannot get it to work.
Here is the content of the crontab file
______________________________
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#* 1 * * * root usr/bin/sarg
#@hourly root usr/bin/sarg
*/10 * * * * root usr/bin/sarg

#

______________________

As you can see, I have commented out the "@hourly" command and inserted the /10 command to get it to execute every ten minutes but it still runs hourly.

Using the crontab -l command to list running jobs I get.
_____________________________________
# m h dom mon dow command
1 * * * * /usr/bin/sarg
___________________________
Showing that the process runs hourly, which indeed it does.
I have tried making the changes and restarting cron like this.

_____________________________________
root@ubuntu240110-desktop:~# sudo service cron stop
cron stop/waiting
root@ubuntu240110-desktop:~# sudo service cron start
cron start/running, process 16968
____________________________

Any ideas how to do ?
-keevill-
Using Ubuntu 10.04

Perceptor 01-31-2011 03:49 AM

*/10 * * * * command
Check out this site too.
Also, I think the reason your entry is not working is a typo, it should be
Code:

*/10 * * * * /usr/bin/sarg

keevill 01-31-2011 07:47 PM

Quote:

Originally Posted by Perceptor (Post 4243200)
*/10 * * * * command
Check out this site too.
Also, I think the reason your entry is not working is a typo, it should be
Code:

*/10 * * * * /usr/bin/sarg

Now it works !! I guess I didn't need the 'root' in front of the command. Neat site too for auto crontab syntax !!
Thx,
-keevill-

Tinkster 01-31-2011 08:06 PM

You didn't necessarily have to be root, but you certainly need the / in front of usr/bin ;}

keevill 01-31-2011 08:56 PM

Quote:

Originally Posted by Tinkster (Post 4244123)
You didn't necessarily be root, but you certainly need the / in front of usr/bin ;}

ahhh... !! Of course - I should have spotted that.

I too prefer to understand rather than blindly follow turnkey solutions - Many thx once again !
-keevill-


All times are GMT -5. The time now is 12:04 PM.