LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-10-2005, 08:56 PM   #1
nguyenzoro
LQ Newbie
 
Registered: Nov 2005
Posts: 3

Rep: Reputation: 0
How to run Bash scripts like thread in Java?


Hi all,

I have a problem like this:
I have a file called as job definition and job dependences in it. In job definition lines, I have jobs executed in order.

And in job dependences, I have job dependences.
Ex : JOBID_002=JOBID_001 -->It means that Job JOBID_002 will be called when Job OBID_001 executed successfully.

I think this problem must be executed in threads like in Java because Job JOBID_003 does not depend any Job. It is still called though JOBID_001, JOBID_002 were error.

How can I do this? Please help me.

[JOB DEFINITION]
JOBID_001, JOBID_002, JOBID_003, JOBID_011, JOBID_012, JOBID_013, JOBID_021, JOBID_031


[JOB DEPENDENCIES]
JOBID_002=JOBID_001
JOBID_021=JOBID_011,JOBID_012,JOBID_003
JOBID_031=JOBID_021
 
Old 11-11-2005, 02:08 AM   #2
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
Just do a topological sort.

Whenever you find a node with indegree = 0, start its job in a new thread.

Whenever a job thread termintates, remove it from the graph, decrementing the indegree of its neighbours (and for each neighbour, check whether its new indegree = 0).

hth --Jonas
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot run install sh scripts, and bash is FUBAR...what to do? asdfjkl Linux - Software 5 11-20-2004 09:09 PM
Suitable place to run bash scripts Skyline Programming 7 01-21-2004 07:37 PM
How to Run perl scripts using bash Boudewijn Linux - Software 2 11-26-2003 03:37 AM
bash scripts won't run aamehl Linux - General 10 09-06-2003 02:25 PM
Install scripts do not run...BASH# no such command tmera Linux - General 1 12-17-2000 02:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration