Starting services the right way.

Art Wildman Art.Wildman at noaa.gov
Mon Jan 14 17:00:32 UTC 2008


Joshua Daniel Franklin wrote:
> On 1/6/08, Matt Joyce wrote:
>   
>> I've inherited a RHEL4 system which runs an application using PostgreSQL and
>> Tomcat.
>> The problem is when the server starts, someone has to login, su as a
>> specific user and start the java application.
>>     
>
> If you're not already, I'd recommend using JPackage RPMs. You may
> even want to add the "Red Hat Developer Suite v.3 for RHEL4" channel
> in RHN which includes JPackage tomcat5 (5.0 IIRC). Then put your
> webapps in /var/lib/tomcat5/webapps/ and you're ready to go.
>
> If you don't already have it, you need to first install java-1.5.0-sun-devel
> or another RPM with proper Provides (from Red Hat Extras channel or
> build your own).
>
> Alternatively you can write a shell script that uses runuser to switch
> to the proper user.
>
>   

Once that is done, Redhat uses some command line tools ('service' & 
'chkconfig') that help manage init services. Here's an example using the 
Postfix mail service, a lot can be learned by examining these scripts 
(man chkconfig)...

service postfix stop
# see /etc/rc.d/init.d/postfix for troubleshooting...
# /usr/sbin/postfix stop && rm -f /var/lock/subsys/postfix
# killall, pgrep and pkill are some linux commands that may come in handy.

# Add postfix back to the 'chkconfig' service startup list. It should 
set the
# correct runlevels to 'on' so the postfix service starts at boot via the
# /etc/rc.d init scripts.
head /etc/rc.d/init.d/postfix | grep chkconfig
# chkconfig: 2345 80 30
#            ^^^^ == runlevels that service will be set by default
chkconfig --add postfix

service postfix restart

-HTH Art at JAX




More information about the redhat-sysadmin-list mailing list