Some of the apachectl commands are related.
apachectl stop
apachectl start
apechtctl status
apachectl restart
apachectl -t
apachectl -S
apachectl -M
apachectl -V
For Solaris 10 and Solaris Express if apache is running under the control of Service Management Facility (SMF,
you need to use the the following commands:
svcs -a apache22
svcs -a | grep -i apache
svcadm disable apache22
svcadm disable -t apache22
svcadm enable apache22
svcsadm enable -t apache22
svcsadm restart apache22
svcsadm refresh apache22
svcsadm clear apache22
# hostname
MySolaris
root@MySolaris:/usr/apache2/2.2/bin# pwd
/usr/apache2/2.2/bin
root@MySolaris:/usr/apache2/2.2# ls -l
total 15 drwxr-xr-x 3 root bin 22 2011-02-18 20:41 bin drwxr-xr-x 3 root bin 13 2011-02-18 20:41 build drwxr-xr-x 2 root bin 101 2011-02-18 20:41 include drwxr-xr-x 4 root bin 5 2011-02-18 20:41 lib drwxr-xr-x 3 root bin 78 2011-02-18 20:41 libexec drwxr-xr-x 3 root bin 3 2011-02-18 20:41 manual drwxr-xr-x 2 root root 3 2011-09-28 00:57 tmp
root@MySolaris:/usr/apache2/2.2/bin# ls -ld apachectl
-r-xr-xr-x 1 root bin 3587 2011-02-18 20:41 apachectl
root@MySolaris:/usr/apache2/2.2/bin# file apachectl
apachectl: executable shell script
root@MySolaris:/usr/apache2/2.2/bin# cat apachectl
#!/bin/sh # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # # Apache control script designed to allow an easy command line interface # to controlling Apache. Written by Marc Slemko, 1997/08/23 # # The exit codes returned are: # XXX this doc is no longer correct now that the interesting # XXX functions are handled by httpd # 0 - operation completed successfully # 1 - # 2 - usage error # 3 - httpd could not be started # 4 - httpd could not be stopped # 5 - httpd could not be started during a restart # 6 - httpd could not be restarted during a restart # 7 - httpd could not be restarted during a graceful restart # 8 - configuration syntax error # # When multiple arguments are given, only the error from the _last_ # one is reported. Run "apachectl help" for usage info # ARGV="$@" # # |||||||||||||||||||| START CONFIGURATION SECTION |||||||||||||||||||| # -------------------- -------------------- # # the path to your httpd binary, including options if necessary HTTPD='/usr/apache2/2.2/bin/httpd' # # pick up any necessary environment variables if test -f /usr/apache2/2.2/bin/envvars; then . /usr/apache2/2.2/bin/envvars fi # # a command that outputs a formatted text version of the HTML at the # url given on the command line. Designed for lynx, however other # programs may work. LYNX="lynx -dump" # # the URL to your server's mod_status status page. If you do not # have one, then status and fullstatus will not work. STATUSURL="http://localhost:80/server-status" # # Set this variable to a command that increases the maximum # number of file descriptors allowed per child process. This is # critical for configurations that use many file descriptors, # such as mass vhosting, or a multithreaded server. ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`" # -------------------- -------------------- # |||||||||||||||||||| END CONFIGURATION SECTION |||||||||||||||||||| # Set the maximum number of file descriptors allowed per child process.
if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then $ULIMIT_MAX_FILES fi ERROR=0 if [ "x$ARGV" = "x" ] ; then ARGV="-h" fi if [ ! -d "/var/run/apache2/2.2" ]; then mkdir -p /var/run/apache2/2.2 chown -R webservd /var/run/apache2/2.2 chgrp -R webservd /var/run/apache2/2.2 fi case $ARGV in start|stop|restart|graceful|graceful-stop) $HTTPD -k $ARGV ERROR=$? ;; startssl|sslstart|start-SSL) echo The startssl option is no longer supported. echo Please edit httpd.conf to include the SSL configuration settings echo and then use "apachectl start". ERROR=2 ;; configtest) $HTTPD -t ERROR=$? ;; status) $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } ' ;; fullstatus) $LYNX $STATUSURL ;; *) $HTTPD $ARGV ERROR=$? esac exit $ERROR
root@MySolaris:/usr/apache2/2.2/bin# ./apachectl -t
Syntax OK
root@MySolaris:/usr/apache2/2.2/bin# ps -ef | grep -i apache2
webservd 11272 723 0 Oct 04 ? 0:02 /usr/apache2/2.2/bin/httpd -k start webservd 27990 723 0 Oct 09 ? 0:01 /usr/apache2/2.2/bin/httpd -k start webservd 746 723 0 Oct 04 ? 1:31 /usr/apache2/2.2/bin/httpd -k start root 723 1 0 Oct 04 ? 3:12 /usr/apache2/2.2/bin/httpd -k start webservd 14317 723 0 20:36:58 ? 0:00 /usr/apache2/2.2/bin/httpd -k start webservd 11897 723 0 Oct 11 ? 0:01 /usr/apache2/2.2/bin/httpd -k start webservd 27564 723 0 Oct 09 ? 0:01 /usr/apache2/2.2/bin/httpd -k start webservd 14315 723 0 20:36:57 ? 0:00 /usr/apache2/2.2/bin/httpd -k start webservd 7217 723 0 Oct 08 ? 0:02 /usr/apache2/2.2/bin/httpd -k start webservd 14621 723 0 Oct 11 ? 0:01 /usr/apache2/2.2/bin/httpd -k start webservd 11896 723 0 Oct 11 ? 0:01 /usr/apache2/2.2/bin/httpd -k start webservd 14316 723 0 20:36:58 ? 0:00 /usr/apache2/2.2/bin/httpd -k start
root@MySolaris:/usr/apache2/2.2/bin# svcadm disable apache22
root@MySolaris:/usr/apache2/2.2/bin# ps -ef | grep -i apache2
root@MySolaris:/usr/apache2/2.2/bin# svcadm enable apache22
root@MySolaris:/usr/apache2/2.2/bin# ps -ef | grep -i apache2
root 14932 1 2 21:01:26 ? 0:01 /usr/apache2/2.2/bin/httpd -k start webservd 14934 14932 0 21:01:28 ? 0:00 /usr/apache2/2.2/bin/httpd -k start webservd 14933 14932 0 21:01:28 ? 0:00 /usr/apache2/2.2/bin/httpd -k start webservd 14936 14932 0 21:01:28 ? 0:00 /usr/apache2/2.2/bin/httpd -k start webservd 14937 14932 0 21:01:28 ? 0:00 /usr/apache2/2.2/bin/httpd -k start webservd 14935 14932 0 21:01:28 ? 0:00 /usr/apache2/2.2/bin/httpd -k start webservd 14938 14932 0 21:01:28 ? 0:00 /usr/apache2/2.2/bin/httpd -k start
root@MySolaris:/var/apache2/2.2/htdocs# svcs -a apache22
svcs: -a ignored when used with arguments. STATE STIME FMRI online 21:01:26 svc:/network/http:apache22
root@MySolaris:/var/apache2/2.2/htdocs# svcadm refresh apache22
root@MySolaris:/var/apache2/2.2/htdocs# ps -ef | grep -i apache2 | grep -v grep
root 14932 1 1 21:01:26 ? 0:02 /usr/apache2/2.2/bin/httpd -k start webservd 15059 14932 0 21:31:26 ? 0:00 /usr/apache2/2.2/bin/httpd -k start webservd 15055 14932 0 21:31:26 ? 0:00 /usr/apache2/2.2/bin/httpd -k start webservd 15060 14932 0 21:31:26 ? 0:00 /usr/apache2/2.2/bin/httpd -k start webservd 15057 14932 0 21:31:26 ? 0:00 /usr/apache2/2.2/bin/httpd -k start webservd 15056 14932 0 21:31:26 ? 0:00 /usr/apache2/2.2/bin/httpd -k start webservd 15058 14932 0 21:31:26 ? 0:00 /usr/apache2/2.2/bin/httpd -k start root@MySolaris:/var/apache2/2.2/htdocs#