skip to main |
skip to sidebar
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:
[/lib/svc/method/apache22]
#ident "@(#)apache22 1.1 08/04/30 SMI"
. /lib/svc/share/smf_include.sh
# 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
}
PIDFILE=/tmp/apache.pid
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
fi
if [ -z $APACHEDATA ]; then
echo "Error: apache22/data property not set"
exit $SMF_EXIT_ERR_CONFIG
fi
case "$1" in
'start')
pidd="PidFile /tmp/apache.pid"
$APACHEBIN/httpd -f ${APACHEDATA}/conf/httpd.conf -C "PidFile /tmp/apache.pid"
;;
'stop')
pidd="PidFile /tmp/apache.pid"
$APACHEBIN/httpd -f ${APACHEDATA}/conf/httpd.conf -k stop -C "PidFile /
tmp/apache.pid"
;;
'refresh')
pidd="PidFile /tmp/apache.pid"
$APACHEBIN/httpd -f ${APACHEDATA}/conf/httpd.conf -k restart -C "PidFile /tmp/ap
ache.pid"
;;
*)
echo "Usage: $0 {start|stop|refresh}"
exit 1
;;
esac
exit $SMF_EXIT_OK
[/var/svc/manifest/application]
<?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
file.
-->
<service_bundle type='manifest' name='apache22'>
<service
name='application/web/apache22'
type='service'
version='1'>
<!--
Wait for network interfaces to be initialized.
-->
<dependency
name='network'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/milestone/network:default' />
</dependency>
<!--
Wait for all local filesystems to be mounted.
-->
<dependency
name='filesystem-local'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/system/filesystem/local:default' />
</dependency>
<exec_method
type='method'
name='start'
exec='/lib/svc/method/apache22 start'
timeout_seconds='60' />
<exec_method
type='method'
name='stop'
exec='/lib/svc/method/apache22 stop'
timeout_seconds='60' />
<instance name='apache22' enabled='false'>
<method_context>
<method_credential user='root' group='root' />
</method_context>
<property_group name='apache22' type='application'>
<propval name='bin' type='astring'
value='/opt/httpd22/bin/' />
<propval name='data' type='astring'
value='/var/httpd22/' />
</property_group>
</instance>
<stability value='Evolving' />
<template>
<common_name>
<loctext xml:lang='C'>
Apache 2.2 httpd
</loctext>
</common_name>
<documentation>
<manpage title='Apache 2.2' section='1' />
<doc_link name='apache.org' uri='http://httpd.apache.org/docs/2.2/' />
</documentation>
</template>
</service>
</service_bundle>
No comments:
Post a Comment