shell script that will run for a specific date

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting shell script that will run for a specific date
# 1  
Old 07-27-2011
shell script that will run for a specific date


I have these changes needed to modify a shell script that will run on a specific date of a month, below pseudocode, appreciate any answers..thanks..

if date of the month is 26th then
    ..event 1
if date of the month is 26th and month are MAR,JUN,SEP,DEC then

# 2  
Old 07-27-2011
If i understand correctly for the rest of months on 26th day event1 will be executed and for the specified months 26th day event 2 will be executed right?
# 3  
Old 07-27-2011
How do you get date? Is it "now" or a parameter (and in what format then)?
# 4  
Old 07-27-2011
TodayDate=$(date +%d)
MonthNum=$(date +%b)
if [ "$TodayDate" -eq "26" ]
 case $MonthNum in
   echo "Event 2";;
        *)  echo "Event 1";;

This User Gave Thanks to itkamaraj For This Post:
# 5  
Old 07-27-2011
yes, prarat that was the scenario..

and yazu,, at the start of the script i see this, is this what you're looking for?

CLMI=`date +"%m%d%y%H%M%S"`
echo 'Currency Load Monitoring #'$CLMI
STARTTIME=`date +"%b %d %H:%M:%S %Y"`
echo 'Time Started: '$STARTTIME
#        grep ^${1}:${2} $PS_HOME/autosys/pass/global.pass  | awk '{print $2}'
DAY=`date +"%a"`

# 6  
Old 07-27-2011
Could you please try this

date=` date +%d`
month=` date +%m`
if [ $date -eq $a ]
if [ $month -eq 03 -o $month -eq 06 -o $month -eq 09 -o $month -eq 12 ]
echo 'Execute event 1'
echo 'Execute event2'
exit 1


---------- Post updated at 02:22 AM ---------- Previous update was at 02:21 AM ----------

small correction a=26
This User Gave Thanks to prarat For This Post:
# 7  
Old 07-27-2011
Hi, I think you can try this as cronjob as below:

* * 26 * * Script_to_be_executed_for_event1
* * 26 "3,6,9,12" * script_to_be_executed_for_event2
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Run shell script based on date file

Hi Team, I have a to run a script based on a date present in a different file which updates everyday. Kindly help with the solution. My current execution : ksh 10152019. But here i want to enter this date from a file which gets updated daily. My appraoch : date file location:... (3 Replies)
Discussion started by: midhun3108
3 Replies

2. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies

3. Solaris

Set script to run during specific times

Hi all, I have this script which sends mail whenever the system is down. It works fine. Normally the system is down from 21 00 to 21 30 from Monday to Saturday and from 21 00 on Sunday to Monday 06 00 for maintenance. So I want the below script to run only when the system is up, i.e outside the... (2 Replies)
Discussion started by: frum
2 Replies

4. UNIX for Dummies Questions & Answers

How to write a shell script to Run it the from Date A to Date B?

Hi , How would i write a shell script to run the code from one date to another date EXample 2014-01-01 to 2014-02-28, can i any provide some clue on this (4 Replies)
Discussion started by: vikatakavi
4 Replies

5. Shell Programming and Scripting

Pass argument in script to run specific part in that

Hello Friends, I need you help ! I have a scripts names which contains command to run bunch of commands for each application you want to install " Oracle " Jboss" etc echo " Which app you want to install Jboss" ? Yes or no? read ans depending on Yes or not it goes inside... (3 Replies)
Discussion started by: saurabh84g
3 Replies

6. UNIX for Dummies Questions & Answers

Find Commands Run on Specific Date

Hello All, I was wondering if anyone knew of a way to find out what commands were run on a specific date. I'm looking to see if I can find certain commands that were run on 3/4, today is 3/10...? Any thoughts or ideas would be much appreciated! Thanks in Advance, Matt ----------... (3 Replies)
Discussion started by: mrm5102
3 Replies

7. UNIX for Dummies Questions & Answers

Script does not run from a user specific cronjob.

Hello, I have two crontabs, one for the root and one for another user. There is a script in my configurations that has to send a email. The script works and sends the emails when I run it by hand with either the root or the user, and when I program it in the root's crontab. But! It does not... (3 Replies)
Discussion started by: Tralaraloro
3 Replies

8. Shell Programming and Scripting

Script to run commands at a specific time.

Hello All, I have written a script which which is working fine to a certain logic of it. But i want a part of the script to run two commands at 00:10 hrs every day. These two command are 1. rm -rf /path/to/folder 2. mail the content of a file. How do i achieve this. Thanks. ... (4 Replies)
Discussion started by: Siddheshk
4 Replies

9. Shell Programming and Scripting

Main script triggers second and it has to run at specific interval

Hi Friends, I am newbie to shell programming and I am stuck trying to accomplish following task.We use Bamboo CI which executes script1 passing parameters. This Main script executes script2 as backend process as part of one of it statements. Task of script2 is to essentially check whether a... (0 Replies)
Discussion started by: aditya206
0 Replies
Login or Register to Ask a Question