Sponsored Content
Full Discussion: Scheduling scheduling !!!
Top Forums Shell Programming and Scripting Scheduling scheduling !!! Post 302594489 by methyl on Tuesday 31st of January 2012 11:49:41 AM
Old 01-31-2012
Another approach is to use the Shell's own background job management and handle the whole lot in one controlling script called from one cron.

This example runs "ls" 10 times concurrently in background, waits until all 10 jobs have finished, then checks for 10 success flag files.

Code:
ls >/tmp/success1 &
ls >/tmp/success2 &
ls >/tmp/success3 &
ls >/tmp/success4 &
ls >/tmp/success5 &
ls >/tmp/success6 &
ls >/tmp/success7 &
ls >/tmp/success8 &
ls >/tmp/success9 &
ls >/tmp/success10 &
#
# Sleep until all 10 background jobs finish
while true
do
        [ ! "`jobs`" ] && break
        sleep 10
done
#
# Check success flags
if [ -f /tmp/success1 -a -f /tmp/success2 -a -f /tmp/success3 \
  -a -f /tmp/success4 -a -f /tmp/success5 -a -f /tmp/success6 \
  -a -f /tmp/success7 -a -f /tmp/success8 -a -f /tmp/success9 \
  -a -f /tmp/success10 ]
then
        echo "11th job goes here"
else
        echo "One or more jobs failed"
fi

 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. Shell Programming and Scripting

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... (4 Replies)
Discussion started by: singhabhijit
4 Replies

5. Programming

Time scheduling

Hello !!! i am trying to create a command scheduler (written in C). Basically i would like to do what the "at" command does , but without using "at" or "cron". I have tried using getitimer but i do not know how can i shcedule multiple commands. Any ideas ??? (2 Replies)
Discussion started by: mcnikolas
2 Replies

6. 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

7. 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

8. Shell Programming and Scripting

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... (2 Replies)
Discussion started by: pvr_satya
2 Replies

9. Shell Programming and Scripting

Scheduling issues

I AM ON SOLARIS I have a script it.sh which is running fine when i execute it from shell command. But when i schedule it in crontab it is throwing error. Why and how can i resolve it ?i am clueless IT.SH #!/bin/sh ORACLE_HOME=/var/opt/oracle/product/10g; export ORACLE_HOME... (1 Reply)
Discussion started by: rafa_fed2
1 Replies

10. UNIX for Beginners Questions & Answers

Scheduling a script

Hi, I have my script in below path in UNIX /storage/sas_source/SDTM-Development/FileWatcher/filewatcher.sh I want to schedule it to run every 30 secs. Please let me know the steps to do it. Thanks. (7 Replies)
Discussion started by: prats_7678
7 Replies
All times are GMT -4. The time now is 01:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy