[Cialug] Starting two jobs at once
Matthew Nuzum
newz at bearfruit.org
Tue Nov 27 16:45:25 CST 2012
On Nov 27, 2012, at 4:41 PM, Matthew Nuzum <newz at bearfruit.org> wrote:
> Right, I know about fg but then you're stuck with a daemon in the foreground and you need to ctrl+c it as well, right? I just want it to die (gracefully if possible). I can imagine in an upcoming project actually having three tasks, sass, mongodb and a python or js based web server. That means ctrl+c ctrl+c ctrl+c.
>
> Zachary, echo $$ returns the PID of the last process started? I tried googling it but didn't get anything remotely helpful. :-)
>
> If so, that might be the solution I'm looking for.
>
> In psuedo code I could do something like:
>
> launch-bg-process &
> p1pid=`echo $$`
> launch-fg-process
> kill $p1pid
> echo Have a nice day!
>
> Does that look right?
>
Alternate googling indicates I may want $!
launch-bg-process &
bg1pid=$!
launch-fg-process
kill $bg1pid
echo Have a nice day!
I'll give it a try!
--
Matthew Nuzum
newz2000 on freenode, skype, linkedin and twitter
♫ You're never fully dressed without a smile! ♫
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4136 bytes
Desc: not available
URL: <http://cialug.org/pipermail/cialug/attachments/20121127/abc6dc59/attachment.bin>
More information about the Cialug
mailing list