|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Run shell script alternate week per month
Hi All, Requirement :- I have shell script in kern shell ,have to run alternate week per month example-today's date is 27 Mar 2013 and my script will run today then for the next time when it will run it should check 1st what was the last run date(27 Mar 2013) if it is matched 15days from current date then run else sent a mail with waning mgs. i have a AWK command it is checking only within a month Code:
date +%Y:%m:%d|awk -vFS=":" -vOFS=":" '{$3=$3-3;print}'suppose i am checking 20days from current date it is give some negative value ex-2013:03:-8 Please give some advice me so i can move forward. Thank you All. Regards, Krupa Last edited by vbe; 03-22-2013 at 06:12 AM.. |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
you can perform epoch arithmetic Code:
1 day = 86400 secs 15 days = 1296000 secs today's date Code:
$ date Fri Mar 22 06:18:17 EDT 2013 script to calculate date after 15 days Code:
today=`date +%s`;let after_15=today+1296000; date -d "@${after_15}"o/p Code:
Sat Apr 6 06:16:39 EDT 2013 |
| The Following User Says Thank You to sam05121988 For This Useful Post: | ||
panyam (03-22-2013) | ||
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Hi, I am getting below errors Code:
`date +%s`;let after_15=today+1296000; date -d "@${after_15}"
date: bad format character - s
ksh: after_15=today+1296000: bad number
date: illegal option -- d
Usage: date [-u] [+format]
date [-u] [mmddhhmm[[cc]yy]]
date [-a [-]sss.fff]this is Working in Bash shell but not in ksh Please provide me alternate solutions Thanks, Krupa Last edited by Franklin52; 03-26-2013 at 05:40 AM.. Reason: Please use code tags for data and code samples |
| Sponsored Links | ||
|
![]() |
| Tags |
| run shell script alternate week |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Finding the nth Particular Week in a Month – shell script | itkamaraj | Answers to Frequently Asked Questions | 1 | 12-05-2012 03:29 PM |
| run the script on every 31st of month..... | aks_1902 | Shell Programming and Scripting | 3 | 10-24-2011 05:29 AM |
| run the script for last day of the month | aks_1902 | Shell Programming and Scripting | 4 | 10-20-2011 02:43 AM |
| Cron job scheduling on the alternate day of the week | kumarmani | Solaris | 7 | 09-30-2008 06:10 AM |
| Execute a script on 4 week of the month | tbdo88 | Shell Programming and Scripting | 1 | 09-30-2006 12:08 PM |
|
|