Find the answer to your Linux question:
Results 1 to 5 of 5
Hi, I would like to schedule jobs so they run one after another. At the moment they are run like: job --id=9 &> log.txt & but they are fighting for ...
  1. #1
    Just Joined!
    Join Date
    Jul 2008
    Posts
    3

    Job Schedular

    Hi,

    I would like to schedule jobs so they run one after another. At the moment they are run like:

    job --id=9 &> log.txt &

    but they are fighting for resources. The jobs are started by different users through a web interface. I'd like to run these through a scheduler that would takes these commands, then batch them up and run them one at a time.

    How would I do this?

    Many thanks,

    monk.e.boy

  2. #2
    Just Joined!
    Join Date
    Sep 2007
    Location
    Lafayette, IN
    Posts
    83
    You might want to check out

    SLURM https://computing.llnl.gov/linux/slurm/

    OpenPBS PBS GridWorks: OpenPBS
    Last edited by Ben Cotton; 07-12-2008 at 08:34 PM. Reason: fixed a typo

  3. #3
    Just Joined!
    Join Date
    Jul 2008
    Posts
    3
    thanks for the reply. Those look a little hard core for what I need

    monk.e.boy

  4. #4
    Just Joined!
    Join Date
    Sep 2007
    Location
    Lafayette, IN
    Posts
    83
    Okay, so basically all you need is a simple program to execute the commands one at a time, without consideration for anything other than the order in which they were received? If that's the case, you can have your web interface append the command to the end of a text file (for example, queue.txt) and then run a script that will execute them. The script might look something like this:

    Code:
    #!/usr/bin/perl
    
    # Queue file
    $queue = 'queue.txt';
    
    open (QUEUE, "$queue") or die;
    @commands = <QUEUE>;
    close (QUEUE);
    $runMe = shift (@commands);
    open (QUEUE, ">$queue") or die;
    foreach ( @commands ) { print QUEUE "$_\n"; }
    close (QUEUE);
    system("$runMe");
    This Perl script will go through your queue, write all but the top command back to the queue file, run the top command and exit. Obviously, you'll need to flesh it out and test it a bit. You'll need to make it so that it runs repeatedly (after each script has ended), but this should get you started at least.

  5. #5
    Just Joined!
    Join Date
    Jul 2008
    Posts
    3
    Doh! It is so obvious when you say it like that

    The external .txt queue is a very very neat idea. I will use it, thanks again

    monk.e.boy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...