
On Fri, Mar 9, 2012 at 4:24 PM, Dave Jensen <feldan1@gmail.com> wrote:
Only problem is trying to get a ircd.chk file to work with Bahamut to make sure the IRCD starts itself should it die or the actual server be rebooted. here is the ircd.chk I am trying to use it is from unreal as I couldn't find one for Bahamut--->> http://pastebin.com/ULeUdExK
Starting a program during boot and keeping it running is a job for init, upstart, or smf, depending on your OS; you shouldn't really need to do a lot to get that. Debian used a SYSV style init, so with a SYSV style init one option would be to edit /etc/inittab and as long as your ircd binary properly supports you executing it without it forking into the background (usually -t for TTY boot) specify something like: IRCD:345:respawn:/usr/bin/sudo -u ircduser /path/to/ircd -t >/dev/null 2>&1 Where /path/to/ircd is the path to your binary and ircduser is the non-root user you sudo to run ircd as. Appended to the bottom of your inittab. Just be very careful and double check any changes to your inittab for correctness; if init doesn't work correctly, the Linux system can't boot into multiuser mode, and it might fail in that manner if certain mistakes are made. Because all the other system daemons (including startup scripts) require the services of init too. Anyways, make sure ircd isn't initially running; do 'initctl t' to signal init to reload its configuration. Then init will run that "/usr/bin/sudo -u ircduser /path/to/ircd -t" command line on boot, respawn it if it exits, and properly send a HUP or TERM signal when the system is shutting down, you have only to make sure sudo is installed, the path to ircd is correct, and that -t is the right option to cause ircd to stay in the foreground. The exception is if it immediately exits after being respawned, and that happens repeatedly (init will disable the IRCD entry if it rapidly exits multiple times, after 5 or 6 attempts -- meaning it can't successfully start ) Providing you have sudo installed, and run ircd as ircduser. Personally, I would do a chroot too before suoing to ircd user, and also apply ulimits, such as a number of processes limit, a virtual memory limit and a RSS limit (limits set as high as reasonable, solely to protect against a runaway process), hard number of files limit (must be larger than the total number of FDs used by the ircd process),, solely out of security considerations, and it's best common practice to apply those sorts of limits to any network daemon. Chroot reduces the exposure in case there is a security bug in the application; if there is no unpatched kernel vulnerability, and ircduser cannot become root, security breach from an exploited irc daemon is contained to the chroot. But executing an application via chroot does require all necessary system library dependencies and libc resource files to properly run the application be copied to the chroot tree, which is an advanced subject, and then you have to deal with updating the copied library files whenever the main system libs are updated, there are automated tools for this. You can reference a simple shell script from the inittab to start ircd with desired options too. -- -JH