[Cialug] Starting two jobs at once

jim kraai jimgkraai at gmail.com
Tue Nov 27 16:51:05 CST 2012


seriously, check out twisted instead of using the shell

find stuff like this
http://stackoverflow.com/questions/4585692/python-nonblocking-subprocess-check-stdout

--jim



On Tue, Nov 27, 2012 at 4:45 PM, Matthew Nuzum <newz at bearfruit.org> wrote:

>
> 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! ♫
>
>
>
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug
>
>


More information about the Cialug mailing list