Run scripts through AutoSys depending on holiday


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Run scripts through AutoSys depending on holiday
# 1  
Old 08-02-2011
Run scripts through AutoSys depending on holiday

Hi all,

I am new to autosys. Can anyone help me in writing autosys job for the below script?

Requirement is : 1.Every day it should run this script at particular time except on holidays.
2.The day after holiday some other script should be running.

Thanks in advance.

Code:
#!/bin/ksh

#set -x

if [ "$#" != "3" ]
then
    echo "Usage: $0 <1stfile_name> <2ndfile_name> <poll_interval_in_sec> "
    exit 1
fi

OLDDATE=$(date --date='3 days ago' +"%Y%m%d")
EXPECTINGDATE=$(date --date='2 days ago' +"%Y%m%d")
TARGETDATE=$(date --date='1 day ago' +"%Y%m%d")

sed -e "s/$EXPECTINGDATE/$TARGETDATE/ig" rename.sh > rename.tmp && mv rename.tmp rename.sh
sed -e "s/$OLDDATE/$EXPECTINGDATE/ig" rename.sh > rename.tmp && mv rename.tmp rename.sh
chmod +x rename.sh

#echo "inputfiledate is $EXPECTINGDATE and outputfiledate is $TARGETDATE and previous date is $OLDDATE"

FIRST_FILE_NAME=$1
SECOND_FILE_NAME=$2
POLL_INTERVAL=$3


while [ "$#" != "1" ]
do
  if  [ -f $FIRST_FILE_NAME  ]
    then 
     
      echo "executing rename.sh for the first time"
      ./rename.sh

      break
    fi
    sleep $POLL_INTERVAL
 echo "File yet to come"
done

while [ "$#" != "1" ]
do
  if  [ -f $SECOND_FILE_NAME  ]
    then
    
      echo "executing rename.sh for the second time"
     ./rename.sh
break 
fi
sleep $POLL_INTERVAL
echo "File yet to come"
done

Moderator's Comments:
Mod Comment Please use [CODE] tags when posting listings, console output, ...
Also, please start a new thread for a question, instead of posting new questions to old threads

Last edited by pludi; 08-02-2011 at 03:39 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Scripts can be run manually but couldn't run with cronjobs

I am from MQ/MB technology. My requirement is to display the queue manger and broker status on daily basis. If I manually run the script, it works fine and displays output. But when I have scheduled the same using cronjobs it shows only the queue manger status and not the broker status. Can... (3 Replies)
Discussion started by: Anusha M
3 Replies

2. Solaris

Job Run Slower using Autosys than running through terminal

Hi All, We run Many jobs evryday using Autosys. Sometimes due to various reason we got to run the job from terminal as well (using nohup). We observed that the job running through terminal(nohup) takes much less time then the autosys (for same job). What can be the possible reason for such... (1 Reply)
Discussion started by: kg_gaurav
1 Replies

3. UNIX for Dummies Questions & Answers

To run ksh script via autosys job without asking password for file transfer

I've K shell script. It will transfer the files from one server to other server using 'SCP' command. While running the script alone as a command line in UNIX ssh terminal its running with out asking password and files are transferred with out asking for password. But by running the script using... (6 Replies)
Discussion started by: maheshbabu
6 Replies

4. Shell Programming and Scripting

Help me!how to run autosys command in UNIX shell script

Hi all, Here is my scenario.. i need to get dates from an existing autosys calendar and compare it with current date with in a unix shell script. Please help me out and give me an approach to handle this....... the general autosys calendar command used is autocal_asc ,but this is... (1 Reply)
Discussion started by: shrik12345
1 Replies

5. UNIX for Advanced & Expert Users

How to recursively run Autosys Box with diff params

Hi all, Does any body know how to recursively run a Autosys Box with different parameters ? For ex: I have a master autosys box that needs to run for JAN 2011, then FEB 2011 .... DEC 2011. FYI, each monthly execution runs for about a day. Is there a way to automate this so that my master... (0 Replies)
Discussion started by: calredd
0 Replies

6. UNIX for Advanced & Expert Users

Autosys job run on Sunday

Hi, I need to create a autosys job which will run on every sunday at 7:30 AM NY time for each 10 min interval of time. days_of_week: su start_mins: 0,10,20,30,40,50 run_window:"07:30" Is it fine? Please help Thanks, Anup (2 Replies)
Discussion started by: anupdas
2 Replies

7. UNIX for Advanced & Expert Users

Autosys run window in EST

Hi, I want to run a job in 5 min duration and start time should be 21:30EST and endtime should be 18:30EST nextday. in long note, it will start from sunday 21:30EST to monday 18:30EST......monday 21:30 EST to tuesday 18:30 EST....tuesday 21:30 ESTto wednesday 18:30EST...wednesday 21:30EST to... (1 Reply)
Discussion started by: millan
1 Replies

8. UNIX for Advanced & Expert Users

run script in autosys at a specified time.

I have created a shell script. I want to run the script in Autosys. Please note my shell script runs as "$ ksh run.ksh" How do I make autosys run this script at 5:00PM every day? insert_job: abc job_type: c box_name: run.box command: ksh run.ksh machine: mach1 #owner: mach1@mymach... (1 Reply)
Discussion started by: gram77
1 Replies

9. Shell Programming and Scripting

Invoke script depending on previous scripts

Hi, I am in desperate needs for advice! I have a script which would invoke various java programs depending on the input parameter and a script which would perform calculation on the data inputted by the first script. The schedule of the job is like this 1) 10:00 am to 11:00 am: call java... (0 Replies)
Discussion started by: mpang_
0 Replies
Login or Register to Ask a Question