aspose file tools*
The moose likes Linux / UNIX and the fly likes Running Dependent Jobs in Unix Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Running Dependent Jobs in Unix" Watch "Running Dependent Jobs in Unix" New topic
Author

Running Dependent Jobs in Unix

Rishi Chopra
Ranch Hand

Joined: Mar 07, 2004
Posts: 108
All,

I have a shell script that gets kicked off at 8:00 which runs a java program
This java program finishes its task around 8:40 (this is not a certain time can finish earlier or get delayed as well)

I have another shell script that has to be made run directly after the above shell script. This script also runs a java process.

Since i really dont have too much hands on experience in Unix so dont know how to run dependent jobs

Also ,

The first process again runs at 12:00 and finishes around 12:40 or something . After this as well i need to kick off my second process

Please Help

Thanks & Regards
Rishi Chopra.


Life is Beautiful Learn to See it.........
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

The simplest way to do that is simply to create a new script that calls the other 2 scripts one after the other and make it be the cron job script.


Customer surveys are for companies who didn't pay proper attention to begin with.
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

If the second should just run if the first was successful (dependent), combine both with && (like in java):

If script1 fails script2 will not be called - assuming either outher circumstances terminating script1, or using the exitstatus in your java programs (System.exit (0) := no error, System.exit (i); // i != 0, i := an errorcode).


http://home.arcor.de/hirnstrom/bewerbung
Rishi Chopra
Ranch Hand

Joined: Mar 07, 2004
Posts: 108
Thanks All
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Running Dependent Jobs in Unix