top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

cron step value in linux

–1 vote
423 views

from man crontab:

Step values can be used in conjunction with ranges. Following a range with / specifies skips of the number's value through the range. For example 0-23/2 can be used in the hours field to specify command execution every other hour (the alternative in the V7 standard is 0,2,4,6,8,10,12,14,16,18,20,22). Steps are also permitted after an asterisk, so if you want to say every two hours, just use */2

As an example, I see:

~# 
~# cat /etc/cron.d/leafnode 
# Cron entries for Leafnode.
# Run /etc/news/leafnode/do-fetch-news every hour.
8 * * * * news if [ -x /etc/news/leafnode/do-fetch-news ]; then /etc/news/leafnode/do-fetch-news; fi

now, every, let's say, two hours I want to run "killall fetchnews" because it has a tendency to stall. Would that look like:

#cron to kill defunct fetchnews
* */2 * * * killall fetchnews

(leaving out the logic of looking for a zombie process (if that's correct terminology))

posted Aug 13, 2013 by Seema Siddique

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
#cron to kill defunct fetchnews
* */2 * * * killall fetchnews

This will kill fetchnews every minute during even hours. It should rather be something like this:
13 */2 * * * killall fetchnews

answer Aug 13, 2013 by Satish Mishra
Similar Questions
0 votes

One of our script need run on first Saturday every month. We have following setup on cron job but it run every Saturday.

15 04 1-7 * 6 /xxx/monthlybk.sh

Any one know how to fix it?

+6 votes

I want to have two cronjob as per following routine.
1. First job I want to start at the start of every month.
2. Second job I want at every 4 hours.

Any suggestions

+2 votes

In my linux system I want to start a cronjob but don't want to enter the enter the cronjob using 'crontab -e' rather want to enter without using 'crontab -e' may be via a script.

Any suggestion on how to achieve this?

0 votes

How do I execute certain shell script at a specific intervals in Linux using cron job?
Please provide examples using different time periods.

...