Sponsored Content
Top Forums Shell Programming and Scripting Shell script to schedule jobs Post 302567754 by agama on Monday 24th of October 2011 11:35:42 PM
Old 10-25-2011
Quote:
Originally Posted by BeefStu
whats wrong with using cron? why are you re-inventing the wheel?
There are other schedulers that are more sophisticated than cron. In this case it sounds like the scheduler of choice provides conditional execution where Job-b depends on the successful execution of Job-a and thus Job-b isn't run until Job-a finishes and was successful. Cron makes no provision for conditional execution and thus isn't useful.

Quote:
Now my concern is how should i create a shell script to do the above activities during weekday and weekend as mentioned below.

During weekday (Monday to friday) these jobs should simply change its flag to COMPLETED as mentioned in point 2.
During weekend (Saturday and Sunday) these job should run and then changes its flag to COMPLETED as mentioned in Point 1.
What these jobs internally does is irrelevant.
Something like this might be what you need. During the week, it executes the change flag script/programme and exits (good). On Saturday and Sunday it executes what ever you need.

Code:
#!/usr/bin/env ksh

case $(date +%a) in
    Sun|Sat)    ;;     # do nothing here, do real work after the case

    *)      CHANGE_FLAG JB_1=COMPLETED;   # nothing to be done, just change and exit 
            exit 0
            ;;
esac

echo "doing the real work now"
CHANGE_FLAG JB_1=COMPLETED
exit 0

Should work in bash too.
This User Gave Thanks to agama For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

schedule many jobs using cron

HI, I need to schedule a no.of jobs using the cron facility. I currently do two kinds of scheduling,one based on the database load(after the database is loaded the program will start) and the other is based on time.....(say 10.00a.m daily) the problem is.......... When the database is loaded... (1 Reply)
Discussion started by: sireesha15
1 Replies

2. Shell Programming and Scripting

Schedule an interactive shell script

Hi, I need to schedule a shell script which executes another shell script along with a series of other commands. When the inner shell script is executed it prompts for a password..... This inner shell cannot be changed How can I do this???? Regards, Chaitrali. (4 Replies)
Discussion started by: Chaitrali
4 Replies

3. Shell Programming and Scripting

how to schedule no of jobs based on the value from the oracle table

Hi all, Please help me with the issue im facing. my client has a recquirement that unix script has to schedule the no.of jobs based on the value from the oracle table.for example if the table has a value of 20 the unix script has to schedule 20 jobs.im able to write the script to get the value... (1 Reply)
Discussion started by: srikanths2s
1 Replies

4. Shell Programming and Scripting

General Q: how to run/schedule a php script from cron jobs maybe via bash from shell?

Status quo is, within a web application, which is coded completely in php (not by me, I dont know php), I have to fill out several fields, and execute it manually by clicking the "go" button in my browser, several times a day. Thats because: The script itself pulls data (textfiles) from a... (3 Replies)
Discussion started by: lowmaster
3 Replies

5. Shell Programming and Scripting

Schedule tasks in shell script

shell=ksh, How could I schedule tasks in shell script INSTEAD OF using the crontab -e functionality? For example, I want a script to print "Hello World" every 10 seconds (i.e., INTERVAL = 10s) until external termination signal is triggered. Thanks, (2 Replies)
Discussion started by: isaacniu
2 Replies

6. Shell Programming and Scripting

Schedule and Run By weekly shell script in cronjob

Hi All, How to schedule a shell script(script name- byweeklyreport.sh) it should run by weekly in corn job or is there any script have to write to check week and then run the above script. example-1st run March 06 2013 2nd run March 20 2013 3rd run April 3 2013... (13 Replies)
Discussion started by: krupasindhu18
13 Replies

7. Shell Programming and Scripting

How to schedule a shell script in Linux centos?

Hi All, I have a script that I need to schedule on daily basis. How can I schedule a script in centos. Like I want to run that script evryday at 10 AM and can I store the output of the script in a log file. Thanks ---------- Post updated 04-18-14 at 12:52 AM ---------- Previous update... (0 Replies)
Discussion started by: Palak Sharma
0 Replies

8. Shell Programming and Scripting

Want to Schedule Shell Script on AIX

Hi All, I want to schedule a shell script on AIX. But Crontab is not working in my AIX Server.Is there any alternative? Please Suggest.. (2 Replies)
Discussion started by: bharat1211
2 Replies

9. Shell Programming and Scripting

Shell script to run multiple jobs and it's dependent jobs

I have multiple jobs and each job dependent on other job. Each Job generates a log and If job completed successfully log file end's with JOB ENDED SUCCESSFULLY message and if it failed then it will end with JOB ENDED with FAILURE. I need an help how to start. Attaching the JOB dependency... (3 Replies)
Discussion started by: santoshkumarkal
3 Replies

10. Shell Programming and Scripting

Schedule a shell script without crontab every Wednesday at 10 AM

HI Guys I need one shell script to be scheduled to run one shell script to be executed automatically every Wednesday at 10 AM Without crontab and "at" command.. Could you provide your suggestions ? Thanks and Regards kshitij Kulshreshtha (6 Replies)
Discussion started by: kshitij
6 Replies
TAP::Parser::Scheduler::Job(3)				User Contributed Perl Documentation			    TAP::Parser::Scheduler::Job(3)

NAME
TAP::Parser::Scheduler::Job - A single testing job. VERSION
Version 3.28 SYNOPSIS
use TAP::Parser::Scheduler::Job; DESCRIPTION
Represents a single test 'job'. METHODS
Class Methods "new" my $job = TAP::Parser::Scheduler::Job->new( $filename, $description ); Given the filename and description of a test as scalars, returns a new TAP::Parser::Scheduler::Job object. Instance Methods "on_finish" $self->on_finish(&method). Register a closure to be called when this job is destroyed. The callback will be passed the "TAP::Parser::Scheduler::Job" object as it's only argument. "finish" $self->finish; Called when a job is complete to unlock it. If a callback has been registered with "on_finish", it calls it. Otherwise, it does nothing. Attributes $self->filename; $self->description; $self->context; These are all "getters" which return the data set for these attributes during object construction. "filename" "description" "context" "as_array_ref" For backwards compatibility in callbacks. "is_spinner" $self->is_spinner; Returns false indicating that this is a real job rather than a 'spinner'. Spinners are returned when the scheduler still has pending jobs but can't (because of locking) return one right now. perl v5.16.3 2013-05-02 TAP::Parser::Scheduler::Job(3)
All times are GMT -4. The time now is 06:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy