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 someYeah 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@gmx.net> To: <icecast-dev@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 tosee> > pid file management, > > ive discussed this before on how to capture the pid, but ended up withalot> > 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@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@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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
dont worry Dave, it'll be committed soon and will be in the next beta...definately in 2.0 oddsock At 03:43 PM 12/1/2003 -0700, you wrote:>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. > > > >Dave St John >Mediacast1 Administration >----- Original Message ----- >From: <gtgbr@gmx.net> >To: <icecast-dev@xiph.org> >Sent: Monday, December 01, 2003 3:34 PM >Subject: Re: REQ: [icecast-dev] Parent Id > > > > 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@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@xiph.org' > > containing only the word 'unsubscribe' in the body. No subject is needed. > > Unsubscribe messages sent to the list will be ignored/filtered. > > >--- >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@xiph.org' >containing only the word 'unsubscribe' in the body. No subject is needed. >Unsubscribe messages sent to the list will be ignored/filtered.--- >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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Dave St John wrote: [pid files]> 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.Whee, this gives me a new perspective to look at the whole thing. :) Indeed, in this case, pid files can be a great help. Anyway, as long as there aren't multiple instances of the same program that need to be controlled by scripts, that pidof script is doing a better job than PID files... it just sounds like it isn't the right tool for the job in your case. Sorry if I made it sound like "eye iz haev teh ulitmaet solutoni". ;P <p>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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
LOL i aint paranoid or anything am i? :o <p><p>Dave St John Mediacast1 Administration ----- Original Message ----- From: "oddsock" <oddsock@oddsock.org> To: <icecast-dev@xiph.org> Sent: Monday, December 01, 2003 4:17 PM Subject: Re: REQ: [icecast-dev] Parent Id <p>> dont worry Dave, it'll be committed soon and will be in the next> beta...definately in 2.0 > > oddsock > At 03:43 PM 12/1/2003 -0700, you wrote: > >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 foregroundand> > > 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 supportsome> >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. > > > > > > > >Dave St John > >Mediacast1 Administration > >----- Original Message ----- > >From: <gtgbr@gmx.net> > >To: <icecast-dev@xiph.org> > >Sent: Monday, December 01, 2003 3:34 PM > >Subject: Re: REQ: [icecast-dev] Parent Id > > > > > > > Dave St John wrote: > > > > Before the official release of icecast2 1.0 (non beta) i would liketo> >see > > > > pid file management, > > > > ive discussed this before on how to capture the pid, but ended upwith> >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 restis> > > 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@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 becomea> > > 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 foregroundand> > > 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 supportsome> > > 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@xiph.org' > > > containing only the word 'unsubscribe' in the body. No subject isneeded.> > > Unsubscribe messages sent to the list will be ignored/filtered. > > > > > >--- >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@xiph.org' > >containing only the word 'unsubscribe' in the body. No subject isneeded.> >Unsubscribe messages sent to the list will be ignored/filtered. > > --- >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@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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
well your solution is a quick fix for the dreaded echo $! | tee pids/file/pid method, which only capture the children fired off into daemon land ;) it is much appreaciated. <p><p><p><p>Dave St John Mediacast1 Administration ----- Original Message ----- From: <gtgbr@gmx.net> To: <icecast-dev@xiph.org> Sent: Monday, December 01, 2003 4:25 PM Subject: Re: REQ: [icecast-dev] Parent Id <p>> Dave St John wrote:> [pid files] > > 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. > > Whee, this gives me a new perspective to look at the whole thing. :) > Indeed, in this case, pid files can be a great help. Anyway, as long as > there aren't multiple instances of the same program that need to be > controlled by scripts, that pidof script is doing a better job than PID > files... it just sounds like it isn't the right tool for the job in your > case. Sorry if I made it sound like "eye iz haev teh ulitmaet solutoni". > ;P > > > 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@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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.