Here is the functionality I am looking for (and haven't quite found):
I have x processes that I want to run sequentially. Some of them could be quite time consuming.
I want these processes to run in the background of my shell.
I know about nohup, but it doesn't seem to work perfectly...assuming job1 is a time consuming job, if I ctrl+c out of the blank line that I get after doing nohup job1 && job2 && job3 &, then job2 and job3 won't run, and job1 might or might not run depending on how long I let nohup run.
Is there a way to get the functionality I want? I am ssh'ed into a linux server. For bonus points, I'd love it if the jobs that I queued up would continue running even if I closed my connection.
Thanks for your help.
EDIT: A small addendum to the question: if I have a shell script with three exec statements
exec BIGTHING exec smallthing exec smallthing
will it definitely be sequential? And is there a way to wrap those all into one exec line to get the equivalent functionality?
ie exec BIGTHING & smallthing & smallthing or && or somesuch
I do agree that screen
is very handy tool. There is additional command line tool enqueue
- that enables enqueuing of additional jobs as needed i.e. even when you had already started one of the jobs, you can add another one when the first one is already running.
Here's sample from enqueue
README:
$ enqueue add mv /disk1/file1 /disk2/file1
$ enqueue add mv /disk1/file2 /disk2/file2
$ enqueue add beep
$ enqueue list
Use screen
.
screen
job1;job2;job3
- separated with semicolons, they will run sequentiallyCTRL-A
, D
(later)
screen -r
Alternatively, if you want a bit more control of your queue, e.g. the ability to list and modify entries, check out Task Spooler
. It is available in the Ubuntu 12.10 Universe repositories as the package task-spooler
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With