LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 03-12-2004, 05:56 PM   #1
bionikxtc
LQ Newbie
 
Registered: Feb 2004
Posts: 5

Rep: Reputation: 0
Starting services at boot


Hi
Im new to Solaris, I need to start apache and a listserv program at startup when the server boots up, but im not familiar with that startup files for Solaris. Im use to the rc.local file in RH9. Please help. Thanks
 
Old 03-12-2004, 09:27 PM   #2
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
Code:
#!/sbin/sh
#
# Copyright 2002 Sun Microsystems, Inc.  All rights reserved.
# Use subject to license terms.
#
#ident  "@(#)apache.sh  1.2     02/01/30 SMI"

APACHE_HOME=/usr/apache
CONF_FILE=/etc/apache/httpd.conf
PIDFILE=/var/run/httpd.pid
TOMCAT_CF=/var/apache/tomcat/conf/server.xml

if [ ! -f ${CONF_FILE} ]; then
        exit 0
fi

# see if we need to start/stop tomcat also

CF=`egrep '^[ \t]*include[ \t]*/etc/apache/tomcat.conf' $CONF_FILE`
if [ -n "$CF" -a -f $TOMCAT_CF ]; then
        TOMCAT=yes
        TC_USER=`egrep '^[ \t]*User[ \t]' $CONF_FILE | nawk '{print $2}'`
else
        TOMCAT=no
fi

case "$1" in
start)
        /bin/rm -f ${PIDFILE}
        cmdtext="starting"
        if [ "x$TOMCAT" != xno ]; then
                (CATALINA_HOME=${APACHE_HOME}/tomcat; export CATALINA_HOME; \
                    CATALINA_BASE=/var/apache/tomcat; export CATALINA_BASE; \
                    JAVA_HOME=/usr/java; export JAVA_HOME; \
                    /bin/su $TC_USER -c \
                    "$CATALINA_HOME/bin/startup.sh") \
                    >/dev/null 2>&1
        fi
        ;;
restart)
        cmdtext="restarting"
        ;;
stop)
        cmdtext="stopping"
        if [ "x$TOMCAT" != xno ]; then
                (CATALINA_HOME=${APACHE_HOME}/tomcat; export CATALINA_HOME; \
                    CATALINA_BASE=/var/apache/tomcat; export CATALINA_BASE; \
                    JAVA_HOME=/usr/java; export JAVA_HOME; \
                    /bin/su $TC_USER -c \
                    "$CATALINA_HOME/bin/shutdown.sh") \
                    >/dev/null 2>&1
        fi
        ;;
*)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;    
esac

echo "httpd $cmdtext."

status=`${APACHE_HOME}/bin/apachectl $1 2>&1`
if [ $? != 0 ]; then
        echo "$status"
        exit 1
fi     
exit 0
This is a default apache startup script from /etc/rc3.d on Solaris 9 install, on my systems it is usually S50apache. Solaris is a SysInit V system so is RedHat, in the same fashion you can create listserv startup as well.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop services from starting at boot augu2000 Slackware 6 11-04-2005 07:24 PM
Starting different services at boot mjjzf Slackware 2 05-21-2005 01:46 PM
a question about starting of services during boot time tuxfood Red Hat 1 04-22-2005 09:59 PM
starting services at boot-time noisybastard Linux - Newbie 2 11-09-2003 05:13 PM
Starting Services InEeDhElPlInUx Linux - Newbie 9 11-06-2003 11:57 AM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 09:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration