crontab entry to run a script on 1st of every month.


 
Thread Tools Search this Thread
Operating Systems Solaris crontab entry to run a script on 1st of every month.
# 1  
Old 04-02-2010
crontab entry to run a script on 1st of every month.

What should be the crontab entry in solaris to run a script on 1st of every month?

Is this correct?

Code:
 
00 02 1 * * <script to be executed>

# 2  
Old 04-02-2010
From the man page for crontab:
Quote:
A crontab file consists of lines of six fields each. The
fields are separated by spaces or tabs. The first five are
integer patterns that specify the following:

minute (0-59),
hour (0-23),
day of the month (1-31),
month of the year (1-12),
day of the week (0-6 with 0=Sunday).
So yes (at 2am).
This User Gave Thanks to son_t For This Post:
# 3  
Old 04-02-2010
then what is below mentioned entry showing? when will it run?

Code:
 
00 02 1 * 1 <script to be executed>

# 4  
Old 04-02-2010
Quote:
Originally Posted by deepaksahni0109
then what is below mentioned entry showing? when will it run?

Code:
 
00 02 1 * 1 <script to be executed>

This will run on the first day of the month if that day is also a Monday.
# 5  
Old 04-02-2010
It means it won't run at all if first day of the month is not a Monday.

---------- Post updated at 08:05 AM ---------- Previous update was at 07:52 AM ----------

Conclusion:-
============
So, this entry will run the script on 1st of every month.
Code:
00 02 1 * * <script to be executed>

wherein this will run it if 1st day of the month is also a Monday. Otherwise it won't run.
Code:
 00 02 1 * 1 <script to be executed>

# 6  
Old 04-02-2010
@ 2:00 Hrs
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Run script on every last sunday of the month

Hi ALL, I have been testing this script to run for every last Sunday of the month,looks like month which have 5 sunday (july 2016 )is not passing this and failing every time. Here is what I am using, current_date=31 echo " CURRENT DAY -> $current_date" if ... (2 Replies)
Discussion started by: netdbaind
2 Replies

2. Shell Programming and Scripting

Script to run on 2 4 and 7 day of the month

I am looking for a unix script which could run a job on 2, 4 and 7 working day of the month. if the days are falling on the saturday/sunday. it should run on the next day. Thank you.. (9 Replies)
Discussion started by: tradingspecial
9 Replies

3. Shell Programming and Scripting

Simpler crontab entry to execute pgm on last day of the month

The following bash command line works for the last day of the month. Test by replacing the 1 with tomorrows day of month number && echo "Day before tomorrow"Can it be used within crontab? As * * 28-31 * * && echo "Today ls last day of month" >>/tmp/crontabtestI tried to test crontab with... (1 Reply)
Discussion started by: lsatenstein
1 Replies

4. Shell Programming and Scripting

Script fails to run properly when run from CRONTAB

Hello all, I'm trying to write a script to gather and send data and it works just fine at the bash command line, but when executing from CRON, it does not run properly. My scripting skills are pretty limited and there's probably a better way, but as I said it works at the command line, but... (12 Replies)
Discussion started by: rusman
12 Replies

5. UNIX for Dummies Questions & Answers

Running Script via Crontab on 2nd Working day each month

Hello Guys, I have a questions regarding running a shell script every second working day each month. I have no clue how solve this problem :wall:. Important is that it has to be the second working (Mo-Fr). Example: If 1st and 2nd Days of month are Sat and Sun the script must run on 4th day... (5 Replies)
Discussion started by: Hollo
5 Replies

6. Shell Programming and Scripting

run the script on every 31st of month.....

Hello expert, I need a logic code {don't want to schedule into crontab} which can run some of my code on 31st of Jan, March, Mya, Aug, Oct, Dec..... Ex: if then echo "success" fi Please help me in achieving this Thanks (3 Replies)
Discussion started by: aks_1902
3 Replies

7. Shell Programming and Scripting

run the script for last day of the month

Hello Experts, I have a script which i want to run the on last day of every month. let say I have backup.sh script which i want to run it every month last day. Can anyone please help :confused: thanks (4 Replies)
Discussion started by: aks_1902
4 Replies

8. Shell Programming and Scripting

crontab: setup cronjob to run first wednesday of every month

Hi, How to setup cronjob to run first wednesday of every month. Is there a way? Thanks.. (9 Replies)
Discussion started by: Anjan1
9 Replies

9. Shell Programming and Scripting

crontab entry to run every last day of the month

i've created a script which should run every last day of the month. what would be the exact crontab entry for this? thanks! (9 Replies)
Discussion started by: tads98
9 Replies

10. Shell Programming and Scripting

crontab entry modification using shell script

hi Friends, iam trying to write a script which will grep the particular entry in crontab of root and enable/disable it .iam a novice in scripting. your suggestions are most welcome..please help Cheers!! (4 Replies)
Discussion started by: munishdh
4 Replies
Login or Register to Ask a Question