REQ: [icecast-dev] Parent Id

Dave St John dstjohn at mediacast1.com
Mon Dec 1 14:43:34 PST 2003



Thanks for the snippet, albeit id still like to see it added :)

> PID files are quite useless junk on the harddisk in most cases... IMO
> they make only sense if you have to run a program in the foreground and
> send signals like SIGUSR1 to it (those that don't have hotkeys like
> CTRL+C). Besides, they come with their own set of potential problems.
> Anyways - Icecast2 is very likely to get optional PID file support some
Yeah i agree. they are useless in way, but in terms of managing 100's of
config files in a hosting environment,
it can get to be a major pain.
Eventualy ill commit my icecast admin #!/bin/bash source to
cvs.casterclub.com for everyone else to use,
just needs some final touches.

<p><p>Dave St John
Mediacast1 Administration
----- Original Message ----- 
From: <gtgbr at gmx.net>
To: <icecast-dev at xiph.org>
Sent: Monday, December 01, 2003 3:34 PM
Subject: Re: REQ: [icecast-dev] Parent Id

<p>> Dave St John wrote:
> > Before the official release of icecast2 1.0 (non beta) i would like to
see
> > pid file management,
> > ive discussed this before on how to capture the pid, but ended up with
alot
> > of bash rigamaroo that mounted to even more
> > headaches.
>
> If I understand you correctly, all you want is the PID of the Icecast
> process and not of its children (probably to be able to script, send
> signals to the right process, etc.)
>
> Well, I'm using OpenBSD mostly, and there's no "pidof" or "killall" here
> ... if I need to script something, I use the following which can be
> considered ``safe''. (The function is what's doing the job, the rest is
> just how I use it stand-alone sometimes). Simple, but effective - no
> insane greppery, no conflicts with additional `ps` output, nor pidof
> having any problems with itself (it can never have a PPID of 1, so it
> won't return its own PID, ever).
>
> --- snip ---
> #!/bin/sh
>
> # pidof() code by Christoph Moench-Tegeder
> # and Michael Erdely (from tech at openbsd.org)
> #
> _pidof()
> {
>         ps -acxo pid,ppid,command | \
>         awk "\$3==\"$1\" && \$2==\"1\" {print \$1}"
> }
>
> if [ $# -ne 1 ] ; then
>         cat << _EOF
> Usage: $0 <daemon_name>
>
> $0 displays the PID of a process,
> if its parent PID is 1.
>
> $0 exits with the return code 0
> if there is a PID to report,
> otherwise the return code is 1.
> _EOF
>         exit 0
> fi
>
> _PID="`_pidof $1`"
> test ${_PID} && echo "${_PID}" || exit 1
> exit 0
> --- snap ---
>
> In order for _pidof() to work with Icecast2, you have to let it become a
> daemon using the -b parameter, e.g. "icecast -b -c icecast.xml"
>
> PID files are quite useless junk on the harddisk in most cases... IMO
> they make only sense if you have to run a program in the foreground and
> send signals like SIGUSR1 to it (those that don't have hotkeys like
> CTRL+C). Besides, they come with their own set of potential problems.
> Anyways - Icecast2 is very likely to get optional PID file support some
> time, but here's already a neat solution today. :)
>
>
> Moritz
> --- >8 ----
> List archives:  http://www.xiph.org/archives/
> icecast project homepage: http://www.icecast.org/
> To unsubscribe from this list, send a message to
'icecast-dev-request at xiph.org'
> containing only the word 'unsubscribe' in the body.  No subject is needed.
> Unsubscribe messages sent to the list will be ignored/filtered.

<p>--- >8 ----
List archives:  http://www.xiph.org/archives/
icecast project homepage: http://www.icecast.org/
To unsubscribe from this list, send a message to 'icecast-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Icecast-dev mailing list