job-control

Why can't I use job control in a bash script?

In this answer to another question, I was told that in scripts you don't have job control (and trying to turn it on is stupid) This is the first time I've heard this, and I've pored over the bash.info section on Job Control (chapter 7), finding no mention of either of these assertions. [Update: The man page is a little better, me...

In what order should I send signals to gracefully shutdown processes?

In a comment on this answer of another question, the commenter says: don’t use kill -9 unless absolutely necessary! SIGKILL can’t be trapped so the killed program can’t run any shutdown routines to e.g. erase temporary files. First try HUP (1), then INT (2), then QUIT (3) I agree in principle about SIGKILL, but the rest i...

Run lynx -dump in background?

I have a bash script mystuff containing a line like lynx -dump http://example.com >tmpfile and the script works fine, including this part, except when I run it non-interactively: $ ./mystuff & [1] 3712 $ jobs [1]+ Stopped The job is stopped. I find that lynx is the culprit. Even running this command directly from the bash prompt ca...

Wait for bash background jobs in script to be finished

To maximize CPU usage (I run things on a Debian Lenny in EC2) I have a simple script to launch jobs in parallel: #!/bin/bash for i in apache-200901*.log; do echo "Processing $i ..."; do_something_important; done & for i in apache-200902*.log; do echo "Processing $i ..."; do_something_important; done & for i in apache-200903*.log; do ec...

Does PHP have job control like bash does?

Hello, does PHP support something like ampersand in bash (forking)? Let's say I wanted to use cURL on 2 web pages concurrently, so script doesn't have to wait before first cURL command finnishes, how could one achieve that in PHP? Something like this in bash: curl www.google.com & curl www.yahoo.com & wait ...

How to start a linux shell as from /etc/inittab

We used to have two entries in our /etc/inittab: ::sysinit:/etc/init.d/rcS ttyS0::respawn:-/bin/sh rcS is a shell script which normally starts our application, but in a special case we called "return" to terminate it which apparently lets the /bin/sh take over the tty as we got a shell prompt where we could do some maintenance. Now t...