Cron for an alternate sunday


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Cron for an alternate sunday
# 8  
Old 06-05-2012
Thanks agama, appreciate it.

could you please give an example for the following?

Quote:
You could always code a dummy script (with echo statements rather than the rm statement), and set it off from cron before next Sunday rather than waiting all week.

thanks again
best regards
user

Moderator's Comments:
Mod Comment edit by bakunin: changed [CODE]..[/CODE]- to [QUOTE]..[/QUOTE]-tags.

Last edited by bakunin; 06-05-2012 at 09:52 PM..
# 9  
Old 06-05-2012
I always use the following construct for sensitive / dangerous operations. As i use ksh i use the "print"-builtin, you may want to change this to "echo" or whatever:


Code:
#!/bin/ksh

SIMULATE=""
# SIMULATE="print -"

...
$SIMULATE <potentially dangerous command>
...


In normal operation "$SIMULATE" evaluates to an empty string and the command just executes. If "SIMULATE" is set to its content like in the commented line then the command is printed instead of executing it.

I hope this helps.

bakunin
# 10  
Old 06-05-2012
Quote:
Originally Posted by user`
could you please give an example for the following?
The script above is an example of this. Just a script that does nothing but echos the state that you can run by hand or drive from cron. Or you can implement something like bakunin suggested. I do something similar that is set when -n (meaning do nothing real) is set on the command line.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

cron job on 3rd sunday of every month

Hi, Actually scheduled my test scripts on test severs as shown below. They are supposed to run on 3rd sunday of every month. Unfortunately it ran on 2nd sunday of the month (suspecting that it will run every sunday). I am sorry if I miss something. Could you please let me know if I did any... (1 Reply)
Discussion started by: System Admin 77
1 Replies

2. UNIX for Dummies Questions & Answers

Yesterday's Date if it is Sunday

Hi All, Can you please let me know how to get the yesterday's date of the given date if the given date is Sunday? I can't use GNU. I have the code to get the yesterday's date based on the system date. Thanks (5 Replies)
Discussion started by: shash
5 Replies

3. Shell Programming and Scripting

How to get first sunday of the month?

Hi, Please can someone help me in getting first sunday date of a month. i_year=`date +%Y` ny_first_sun_nov=`cal 10 $i_year | sed '/^$/d' |head -3 |tail -1| rev | cut -c1` This works good if the first sunday has a value but not if it is blank and first sunday falls on second week. ... (17 Replies)
Discussion started by: infyanurag
17 Replies

4. Shell Programming and Scripting

Second sunday of March

Hi, I want to get the second Sunday of march in any year, I have tried below command but it is not giving me the correct output i_year=`date +%Y` cal -m 03 $i_year | sed '/^$/d' |head -4 |tail -1|rev | cut -c1` This is returning me 0 , where as I want 10. Can you please help Thanks (5 Replies)
Discussion started by: infyanurag
5 Replies

5. UNIX for Advanced & Expert Users

How to get the count of sunday between two dates?

Hi Am using unix Ksh I have the two dates DATE1=01/01/2013 DATE2=11/02/2013 In this two dates i need the output as count of sunday sunday=6 Can anyone help me pls!!! (1 Reply)
Discussion started by: Venkatesh1
1 Replies

6. UNIX for Advanced & Expert Users

How to get the sunday days between two dates?

Hi Am using Unix Ksh I have a two date input as DATE1=02/12/2012 DATE2=30/12/2012 I Need the output as only sunday date 02/12/2012 09/12/2012 16/12/2012 23/12/2012 30/12/2012 can anyone pls help me.. thanks in advance... (2 Replies)
Discussion started by: Venkatesh1
2 Replies

7. Solaris

How to check for Saturday or Sunday

Hi , I have a date parameter passed in YYYYMMDD format , how can I check whether it is Sat or Sun on Solaris box , as we can do the same easily on linux box by using date -d YYYYMMDD '+a' . Any pointres will be really helpful . (5 Replies)
Discussion started by: harpreetanand
5 Replies

8. UNIX for Dummies Questions & Answers

Cron job -- to execute at every first Sunday of every month

Dear all How can I schedule the cronjob to be run sometime at every first Sunday at every month? I have the edit the cronjob every month now, thanks (2 Replies)
Discussion started by: shanemcmahon
2 Replies

9. Shell Programming and Scripting

Date - Last Sunday thru Saturday

Hi All, I have to kick off a script on every Monday to get some data from database for last week (Sunday thru Saturday). If its Monday (12/12/2005) Begin date will be Sunday - 12/4/2005 End date will be Saturday - 12/10/2005 The script might not kick off on some Mondays. So my... (2 Replies)
Discussion started by: skymirror
2 Replies
Login or Register to Ask a Question