Thursday, November 4, 2010

Getting Apache 2.2 working under Solaris using SMC

Don't ask me why I did this (it was painful), but I got Apache 2.2 running on Solaris 10 using the SMC instead of the default pre-fork model.  Results to be figured out later.  Anyway, for those interested here are the relevant files.  For those curious I do use zones and this is in one:


#ident  "@(#)apache22        1.1     08/04/30 SMI"

. /lib/svc/share/

# SMF_FMRI is the name of the target service. This allows multiple instances
# to use the same script.

getproparg() {
        val=`svcprop -p $1 $SMF_FMRI`
        [ -n "$val" ] && echo $val

APACHEBIN=`getproparg apache22/bin`
APACHEDATA=`getproparg apache22/data`

if [ -z $SMF_FMRI ]; then
        echo "Error: SMF framework variables are not initialized"
        exit $SMF_EXIT_ERR

if [ -z $APACHEDATA ]; then
        echo "Error: apache22/data property not set"
        exit $SMF_EXIT_ERR_CONFIG

case "$1" in
pidd="PidFile /tmp/"
$APACHEBIN/httpd -f ${APACHEDATA}/conf/httpd.conf  -C "PidFile /tmp/"

pidd="PidFile /tmp/"
        $APACHEBIN/httpd -f ${APACHEDATA}/conf/httpd.conf -k stop  -C "PidFile /

pidd="PidFile /tmp/"
$APACHEBIN/httpd -f ${APACHEDATA}/conf/httpd.conf -k restart -C "PidFile /tmp/ap"

        echo "Usage: $0 {start|stop|refresh}"
        exit 1



<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
 Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
 Use is subject to license terms.

 ident  "@(#)apache22.xml  1.1     08/04/30 SMI"

        NOTE:  This service manifest is not editable; its contents will
        be overwritten by package or patch operations, including
        operating system upgrade.  Make customizations in a different

<service_bundle type='manifest' name='apache22'>


Wait for network interfaces to be initialized.

        <service_fmri value='svc:/milestone/network:default' />


Wait for all local filesystems to be mounted.

    <service_fmri value='svc:/system/filesystem/local:default' />

    exec='/lib/svc/method/apache22 start'
    timeout_seconds='60' />

exec='/lib/svc/method/apache22 stop'
timeout_seconds='60' />

<instance name='apache22' enabled='false'>

    <method_credential user='root' group='root' />

    <property_group name='apache22' type='application'>
        <propval name='bin' type='astring'
            value='/opt/httpd22/bin/' />
        <propval name='data' type='astring'
            value='/var/httpd22/' />


<stability value='Evolving' />

        <loctext xml:lang='C'>
            Apache 2.2 httpd

        <manpage title='Apache 2.2' section='1' />
        <doc_link name='' uri='' />



No comments:

Post a Comment