5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
23 # Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
26 .
/lib
/svc
/share
/smf_include.sh
29 APACHE_USR_ROOT
=/usr
/apache2
30 APACHE_ETC_ROOT
=/etc
/apache2
31 APACHE_VAR_ROOT
=/var
/apache2
33 #if startup options contain multiple arguments separated by a blank,
34 #then they should be specified as below
35 #e.g., %> svccfg -s apache24 setprop httpd/startup_options=\("-f" "/etc/apache2/2.4/new.conf"\)
41 svcprop
-q -p $1 ${SMF_FMRI}
42 if [ $?
-eq 0 ] ; then
43 PROPVAL
=`svcprop -p $1 ${SMF_FMRI}`
44 if [ "${PROPVAL}" = "\"\"" ] ; then
52 # Check whether alternate config file was specified using option -f.
53 # If it's the case, Apache will search in the same directory for
54 # availability of environment file.
55 envvars_path_update
() {
57 while [ $# -gt 0 ]; do
59 -f) APACHE_USER_ENVVARS
=`dirname "${2:-}"`/envvars
; break;;
60 -f*) APACHE_USER_ENVVARS
=`dirname "${1#-f}"`/envvars
; break;;
66 APACHE_VERSION
=`echo ${SMF_FMRI} | sed 's/[^0-9]//g;s/./\.&/g;s/^\.//'`
67 if [ "x${APACHE_VERSION}" != "x" ]; then
68 echo "Apache version is ${APACHE_VERSION}"
69 APACHE_USR_ROOT
=${APACHE_USR_ROOT}/${APACHE_VERSION}
70 APACHE_ETC_ROOT
=${APACHE_ETC_ROOT}/${APACHE_VERSION}
71 APACHE_VAR_ROOT
=${APACHE_VAR_ROOT}/${APACHE_VERSION}
74 APACHE_USER_ENVVARS
=${APACHE_ETC_ROOT}/envvars
76 APACHE_HOME
=${APACHE_USR_ROOT}
77 APACHE_BIN
=${APACHE_HOME}/bin
78 HTTPD
=${APACHE_BIN}/httpd
80 getprop httpd
/startup_options
81 if [ "${PROPVAL}" != "" ] ; then
82 echo startupoptions
set
84 STARTUP_OPTIONS
="${PROPVAL} -k"
85 envvars_path_update
"${PROPVAL}"
89 if [ "${PROPVAL}x" == "workerx" ] ||
[ "${PROPVAL}x" == "preforkx" ] ; then
90 HTTPD
="${HTTPD} -D ${PROPVAL}"
104 echo "Usage: $0 {start|stop|refresh}"
105 exit $SMF_EXIT_ERR_CONFIG
109 HTTPD
="${HTTPD}" APACHE_USER_ENVVARS="${APACHE_USER_ENVVARS}" ${APACHE_BIN}/apachectl ${STARTUP_OPTIONS} ${cmd} 2>&1
111 if [ $? -ne 0 ]; then
112 echo "Server failed to start. Check the error log
(defaults to
${APACHE_VAR_ROOT}/logs
/error_log
) for more information
, if any.
"
113 exit $SMF_EXIT_ERR_FATAL