ptrace in production systems

ptrace in production systems

Valery Reznic valery_reznic at yahoo.com
Sun Feb 1 16:25:57 IST 2009




--- On Sun, 2/1/09, Shachar Shemesh <shachar at shemesh.biz> wrote:

> From: Shachar Shemesh <shachar at shemesh.biz>
> Subject: Re: ptrace in production systems
> To: valery_reznic at yahoo.com
> Cc: "linux-il" <linux-il at cs.huji.ac.il>
> Date: Sunday, February 1, 2009, 4:18 PM
> Valery Reznic wrote:
> > 
> > 
> >   What about following:
> > #!/bin/sh
> > 
> > while :; do
> >    snmp_agen
> > done
> > 
> >   
> A daemon returns immediately. Even had that been what I
> wanted (it's not - sometimes we really want to shut down
> the agent) what you wrote is a busy loop that keeps trying
> to launch the agent.
I knew I miss something :(

Usually daemons have switch something like 'keep in foreground'
So script can be changed to
while :; do
    snmp_agen --keep-in-foreground
done

And whole script should be run in the background.
If you want some way to shut down the agent you can kill script and then agent.
Or catch say SIGTERM in the script and kill agent from the script itself.

Valery.
> 
> Shachar


      



More information about the Linux-il mailing list