Shell script for scheduling


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script for scheduling
# 1  
Old 01-21-2005
Shell script for scheduling

Hi guys,

I am new guy for unix. I need help writing the following shell script.
My requirement is:

I have few pl/sql procedures(lets say 10). I want to run some of them (say 5) parallally in the background and once these are completed trigger the next ones one after other.

Could some one give some ideas on how to keep track of the first 5 background processes and how it can be implemented.(some sample script would be appreciated.)

Thanks
Chandu
# 2  
Old 01-22-2005
Welcome, this seems to be a homework question. You should post what you have worked out already. If this is a homework question, please read the Unix.com forum's Rules.

Quote:
Originally Posted by https://www.unix.com/showthread.php?t=2971

(6) Do not post classroom or homework problems.
# 3  
Old 01-22-2005
This may be a legitimate post. Create a temp table in your database, have each procedure post back to the table. This is how our project tends to do these sorts of things. Table is small and has columns such as: job ID, current status (in progress, success, failure) and a date/time column of the last update.Drop the table if it is not needed after your run.
# 4  
Old 01-22-2005
This is actually our project requirement. I described here it as a small assignment, but actually we have about 150 procedures and some of them can be run parallally and some of them have dependency. Our objective is to write a shell script to schedule this task. I have no idea about how to start with and request your ideas/suggestions.

Google: could you be more specific. When the first set of procedures triggered in the background how do we monitor for its status and trigger the next dependent job when it is done. I mean do we need to use some kind script which keeps on checking this job status table in specific intervals?

thanks for your suggestions in advance.
# 5  
Old 01-22-2005
We have a couple of tables set up:a job dependency table (holds job id and jod dependency ID among other things) and aother is a job master table (table containing all jobs and job ids) and finally a job status table. Shell scripts control the execution of stored procedures. Before a procedure is executed the shell runs a small sql statement to check the job status table to see if the current job is able to run. If the last status is success, and the dependency is also met everything is good. The controlling shell also updates the job status table based upon the status of the PL/SQL it kicked off (in progress, success, failure). this works well for us but we dont have 150 procedures to run in parallel either Smilie
# 6  
Old 01-22-2005
You may not need this but your first post mentions you are new to UNIX, disregard if you already know this. Here is a link that shows how you execute a stored procedure from a shell and capture output variables.
# 7  
Old 01-22-2005
Once you follow google's tips you will have the individual jobs. Now let's say that you want job1, job2, and job3 to run in parallel followed by job4, job5, and job6 running in parallel. You could write a script:
#! /usr/bin/ksh
/path/to/job1 &
/path/to/job2 &
/path/to/job3 &
wait
/path/to/job4 &
/path/to/job5 &
/path/to/job6 &
wait
exit 0

The ampersands tell ksh to background the jobs. The "wait" without any parameters says to wait for all background jobs.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

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

2. Shell Programming and Scripting

Error while scheduling the shell script

I am getting the below error while scheduling the job.Why? 00 30 * * * /arbor/integ_fx/rahul_raj/itsr_5652_v2/it.sh /arbor/integ_fx/rahul_raj/itsr_5652_v2 "/tmp/crontabBvaWiv" 47 lines, 2412 characters 00 30 * * * /arbor/integ_fx/rahul_raj/itsr_5652_v2/it.sh ... (2 Replies)
Discussion started by: rafa_fed2
2 Replies

3. Shell Programming and Scripting

Shell script scheduling in cronjob

Hi, I have developed a file deletion script and scheduled it in cronjob to run daily at 5:00 AM. But the script is not running automatically any day. However when I run the script manually at any time, it runs successfully. This is how the cron looks like : 0 5 * * *... (5 Replies)
Discussion started by: jhilmil
5 Replies

4. Shell Programming and Scripting

Scheduling a Ksh script

All, Running the below script independently is working fine with no issue but once I am scheduling it in cron on my Linux environment it is not working. Can anyone look into this and let me know what I have to modify here to schedule it properly. 09 03 * * 4 ksh 'cd... (1 Reply)
Discussion started by: Oracle_User
1 Replies

5. UNIX for Dummies Questions & Answers

Scheduling a script by using Crontab

Hi, I need to schedule a script in crontab which should run at 01:00 am in the morning and should run for every 15 days in a month. How to schedule this by using crontab? Many thanks. Rgds, (13 Replies)
Discussion started by: venkatesht
13 Replies

6. UNIX for Advanced & Expert Users

Scheduling a script other than crontab

Hi, How can we run/schedule a shell script. Since there is no access to cron at this point of time we have to think other way out to run a script every hour. How can we achieve this. Need advice. How about using sleep,autosys etc...the script should trigger off every hour...which sends... (3 Replies)
Discussion started by: noorm
3 Replies

7. Solaris

Passing arguments to a shell script from file while scheduling in cron

Hi, I have a shell script Scp_1.sh for which I have to pass 2 arguments to run. I have another script Scp_2.sh which in turns calls script Scp_1.sh inside. How do I make Scp_1.sh script to read arguments automatically from a file, while running Scp_2.sh? -- Weblogic Support (4 Replies)
Discussion started by: weblogicsupport
4 Replies

8. UNIX for Dummies Questions & Answers

Problem with scheduling a shell script on cygwin using cron

Hi, Before I start, I would like to inform that, I went through all FAQs and other threads before posting here. I 'm trying to schedule a shell script on cygwin using cron. No matter what I do I don't seem to get the cron job executing my bash script. My script is temp.sh echo `date` >... (4 Replies)
Discussion started by: shash
4 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. Shell Programming and Scripting

scheduling script to run another script on Solaris

Hi everyone, I am trying to automate one process on Solaris OS. This is what happens at the moment. Every night at 19:30 and every hour after that we run a script that checks the status of databases. That script runs and prints if db's are OK at the end it states how many were down. I am... (3 Replies)
Discussion started by: andrei
3 Replies
Login or Register to Ask a Question