help required on scheduling


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help required on scheduling
# 1  
Old 01-06-2011
Question help required on scheduling

hi

I have a script, abc.sh
first time user will start a script using <<abc.sh start >>, inside a script using " at " i am schduling same script for every one hour. so my script always running .
total script execution time takes around 1sec
for closing same << abc.sh stop>>

here my problem is once it is started (schduled), if any other one staring again using <<abc.sh start >> in another terminal,then new instance has to report about old instance of script to user

how to do this
# 2  
Old 01-06-2011
use a wrapper script, which can schedule the abc script, and then if required call that script.
# 3  
Old 01-06-2011
May be like below:
Create an empty file when script is schedule by 'at' and check for this file existance when 1st argument is 'start'
Code:
if [ $1 = "start" ]; then
   if [ -f script_scheduled ]; then
      echo "Script is already running/scheduled"
      exit
   fi
fi
<Do other stuffs>
touch script_scheduled
<schedule using at>

Make sure to add code for removing file while stopping the script:
Code:
if [ $1 = "stop" ]; then
   rm -f script_scheduled
fi


Last edited by anurag.singh; 01-06-2011 at 08:04 AM.. Reason: Correction
This User Gave Thanks to anurag.singh For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Need help regarding cronjob scheduling

Hello All, I have three requirements to schedule three shell scripts in crontab. Could you please help me in this: 1) To schedule a shell script every 5mins interval every day between 10PM to 10:30PM 2) To schedule a shell script every 10min interval every day between 9AM to 10AM. 3) To... (6 Replies)
Discussion started by: abhi_123
6 Replies

2. Shell Programming and Scripting

Scheduling scheduling !!!

Hi, i have 10 sh scripts. All are running in parallel using cron tab and each script gives "success" flag files once the execution is completed. and, now i have 11th script which should look for "success" flag from those 10 sh scripts. once all the 10 flag files found, 11 th script has to do... (9 Replies)
Discussion started by: nago123
9 Replies

3. Programming

Scheduling Queues: Help

I have a problem understanding the different scheduling queues (Ready Queue, I/O Queue, Job Queue) Can you please explain/illustrate/differentiate these queues to me? Thanks a lot guys.;) (1 Reply)
Discussion started by: zel2zel
1 Replies

4. Shell Programming and Scripting

Crontab scheduling

Hi all, My OS is Solaris 10. I want to schedule a job which i need to run between morining 6 to eve 6 once for every 2 hours. This is what i did. 0 6-18 * * 1-5 /monitor.sh It runs for every hour how to make it for every two hours ...... Thanks, Firestar. (1 Reply)
Discussion started by: firestar
1 Replies

5. Linux

Help with cronjob scheduling

Hi Everybody, How to schedule a job using cron that shouldn't run between working hrs 9am-5pm, while run in non working hrs every hour, every day of the month, month & week. I tried the following way, not sure I can use logical not operator(!). Please correct me if wrong or suggest other... (2 Replies)
Discussion started by: sudhirav
2 Replies

6. Shell Programming and Scripting

Getting required fields from a test file in required fromat in unix

My data is something like shown below. date1 date2 aaa bbbb ccccc date3 date4 dddd eeeeeee ffffffffff ggggg hh I want the output like this date1date2 aaa eeeeee I serached in the forum but didn't find the exact matching solution. Please help. (7 Replies)
Discussion started by: rdhanek
7 Replies

7. UNIX and Linux Applications

Job Scheduling

I am working on UNIX AIX system, with Oracle OS. We are not supposed to use any tools to schedule our unix shell scripts. Basically we have to make use of Oracle tables and Shell scripts to manage dependencies, restartability, scheduling, parallelizing,etc. If anyone has worked/ is working... (1 Reply)
Discussion started by: singhabhijit
1 Replies

8. HP-UX

cron scheduling?

Hi all, i want a job to run first monday of every of month. (1 Reply)
Discussion started by: megh
1 Replies

9. Shell Programming and Scripting

script scheduling

Hi, I have a ksh scrip (x) that scans a directory and does actions when a file arrives in this directory. My question is what is the best way to schedule x? 1. Use cron tab and create a task running forever 2. Creat another ksh script (y) that runs (x) in a non-terminating loop Which... (2 Replies)
Discussion started by: GNMIKE
2 Replies

10. UNIX for Dummies Questions & Answers

scheduling

i have tried to schedule my process at a certain time using the at command : the error says bad time specification can somebody help me i used at 2300 job thanks (2 Replies)
Discussion started by: prashantuc
2 Replies
Login or Register to Ask a Question