From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@sunsite.dk
Subject: Re: jobs -Z example?
Date: Sun, 15 Mar 2009 12:47:49 -0700 [thread overview]
Message-ID: <090315124749.ZM5277@torch.brasslantern.com> (raw)
In-Reply-To: <20090315182446.60806.qmail@smasher.org>
On Mar 16, 7:24am, Atom Smasher wrote:
}
} can someone point me to an example of "jobs -Z" in action?
torch% ps $$
PID TTY STAT TIME COMMAND
5249 pts/4 Ss 0:00 Src/zsh -f
torch% jobs -Z "You can't see me"
torch% ps $$
PID TTY STAT TIME COMMAND
5249 pts/4 Ss 0:00 You can't see me
torch% print $(< /proc/$$/cmdline )
You can't see me
torch%
If you mean an explanation of why you'd *want* to do that sort of
thing, the reasons can be a bit obscure. As one real-world example,
at work we run a job queuing system where a controller process passes
tasks to a set of worker processes. The worker processes are each a
subshell of a "foreman" script which runs in an infinite loop to keep
track of how many workers are active and to start a new one when one
exits.
So the script at startup runs something like
jobs -Z "worker:foreman"
and when each subshell starts it runs
jobs -Z "worker:task"
That way, we can differentiate in "ps" output which process is which,
rather than having them all appear to be copies of the same script.
If we want to shut the system down cleanly, we kill the foreman and
let the workers die off as their tasks complete.
Yes, we could do this by having the foreman write it's PID to a file
instead, etc. This just makes it obvious when running "top" or other
system monitoring.
next prev parent reply other threads:[~2009-03-15 19:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-15 18:24 Atom Smasher
2009-03-15 19:47 ` Bart Schaefer [this message]
2009-03-15 20:49 ` Atom Smasher
2009-03-15 21:05 ` Christian Schneider
2009-03-15 21:07 ` Bart Schaefer
2009-03-15 21:41 ` Atom Smasher
2009-03-15 22:08 ` Bart Schaefer
2009-03-15 22:13 ` Atom Smasher
2009-03-16 2:07 ` Dan Nelson
2009-03-16 4:08 ` Bart Schaefer
2009-03-16 4:43 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=090315124749.ZM5277@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).