Reading a crontab 3 * * 1,3,5 /path/of/script.sh

Hi!

We are on AIX 6.1 TL6

I am an Admin for a Content Management application that is hosted on an AIX machine and i am supposed to come up with a cronjob that runs every monday at 03:00 am.

The current schedule of that cron job is :

3 * * 1,3,5 /path/of/script.sh

But i do not know how to understand this

Can someone tell me what that schedule means and what must it be changed to for running every Monday.

Thanks!

Shouldn't it be :

0 3 * * 1 /path/script.sh

instead ?

man crontab
man cron
1 Like

This means:

0 min/ of the 3rd hour/ of every day / every hour / Monday

Am i correct ?

From the man page for crontab on AIX 6.1:

The crontab File Entry Format

       A crontab file contains entries for each cron job. Entries are separated by newline characters. Each crontab file entry contains six fields
       separated by spaces or tabs in the following form:

       minute  hour  day_of_month  month  weekday  command

       These fields accept the following values:
       minute
            0 through 59
       hour
            0 through 23
       day_of_month
            1 through 31
       month
            1 through 12
       weekday
            0 through 6 for Sunday through Saturday
       command
            a shell command

---------- Post updated at 03:38 PM ---------- Previous update was at 03:36 PM ----------

So with ctsgnb correction, you have 3am every Monday.

1 Like

Thank you!

I also have another question, but i dont know if i must open a new thread.

In the crontab, i need to include shutdown command and also the start up command in the following order

This should run first - 0 3 * * 1 /path/shut_down_first.sh
This should run after the above one - 0 3 * * 1 /path/start.sh

The idea is...the service must be shutdown and restarted every monday at 3 am.

Can you help me with this ?

Thanks a ton!

0 3 * * 1 /path/shut_down_first.sh && /path/start.sh

or if want to do more elaborate checks between the shutDown and the startUp steps, implement a bounce.sh script and do it all there.

1 Like