Page 1 of 1

Question About ircd.pid

Posted: Wed Dec 22, 2004 5:41 pm
by GhostChildren
In the event of a crash/shutdown, does Unreal remove the ircd.pid file from it's directory, or does it stay until the next start? I'm writing a small shell script to check whether or not the IRCd is running so it would be helpful to know what happens to the file. Thanks. :)

Posted: Wed Dec 22, 2004 6:21 pm
by codemastr
Well, if Unreal crashes, there is no way for it to do anything (it's dead) so no, it won't delete the file. The standard way to test if a process is running (as can be seen in the chkircd script) is to send it a SIGCHLD

Posted: Wed Dec 22, 2004 6:54 pm
by GhostChildren
I see, thanks. I'm looking at the chkircd script and I have two questions if someone wouldn't mind.

First, is there an advantage to using the "test -r" command to see if the pid file exists over merely using the -e switch with if?

Second, in the line:

Code: Select all

if `kill -CHLD $ircdpid >/dev/null 2>&1`; then
What does the 2>&1 do at the end there?

Posted: Wed Dec 22, 2004 7:54 pm
by codemastr
This is UnrealIRCd support, not shell scripting. If you need help with shell scripting, I'd suggest you use Google. A quick search answered both of your questions
http://www.faqs.org/docs/abs/HTML/fto.html
http://wks.uts.ohio-state.edu/unix_cour ... EADING69-0