Am 27.04.2011 22:54, schrieb Alec T. Habig: > Pablo Cavero writes: >> The Only that I need is a set of bash script, like script used by the >> "tomcat", for example, or need a special binary executable?? >> http://www.laliluna.de/articles/tomcat-startup-script-linux.html >> >> I want to may will use chkconfig, like an standar service. > > The chkconfig script part is easy, just look in /etc/rc.d/init.d, steal > an existing service's script, and modify it to run what you want. Note > the commented line at the top starting with "chkconfig" - that > information specifies the run levels chkconfig will set it up to be > activated in, and the startup/shutdown priority. > > As for the code you run, that gets trickier. All the startup scripts do > is start and stop things. Those "things" could be more scripts, > executables, or combinations thereof. Areas to pay attention to with > your code (to get it to behave nicely when run this way) include: > getting it daemonized properly (dropping and/or redirecting IO streams), > privilege seperation (can it run as a non privleged user? if so, do > that, if not, be really careful and have only the bare minimum code run > with elevated privileges), logging (have it log status information, > ideally with customizeable log levels, to the appropriate place), and > signal handling so it shuts down cleanly when told to, reloads > configuration files if asked, etc. >
There is also libdaemon which is meant to facilitate converting your program into a proper daemon (not tried it, though). BTW: It is a shame that SL does not contain the start-stop-daemon like Gentoo or Ubuntu (http://manpages.ubuntu.com/manpages/dapper/en/man8/start-stop-daemon.8.html). It makes converting arbitrary executables into daemons a matter of minutes. Regards, Florian Philipp
signature.asc
Description: OpenPGP digital signature
