SCIENTIFIC-LINUX-USERS Archives

April 2011

SCIENTIFIC-LINUX-USERS@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Alec T. Habig" <[log in to unmask]>
Reply To:
Alec T. Habig
Date:
Wed, 27 Apr 2011 15:54:33 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (30 lines)
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.

-- 
 	    Alec Habig, University of Minnesota Duluth Physics Dept.
	    		    [log in to unmask]
		       http://neutrino.d.umn.edu/~habig/

ATOM RSS1 RSS2