The power of the SMF Apache2 service

I am in the process of migrating some old Solaris 8 web servers to Solaris 10, and plan to use SMF to stop and start Apache. Solaris ships with a relatively recent release of Apache (if only it included the LDAP authentication module and PHP), which is nicely integrated with SMF. If your a *NIX admin, you gotta love the fact that SMF will restart processes for you:

$ svcadm enable apache2

$ ps -ef | grep http

webservd 16663 16660   0 09:57:59 ?           0:00 /usr/apache2/bin/httpd -k start
webservd 16662 16660   0 09:57:59 ?           0:00 /usr/apache2/bin/httpd -k start
webservd 16661 16660   0 09:57:59 ?           0:00 /usr/apache2/bin/httpd -k start
webservd 16664 16660   0 09:58:00 ?           0:00 /usr/apache2/bin/httpd -k start
webservd 16665 16660   0 09:58:00 ?           0:00 /usr/apache2/bin/httpd -k start
    root 16660     1   2 09:57:58 ?           0:00 /usr/apache2/bin/httpd -k start

$ pkill httpd

$ ps -ef | grep http

webservd 16689 16686   0 09:58:08 ?           0:00 /usr/apache2/bin/httpd -k start
webservd 16690 16686   0 09:58:08 ?           0:00 /usr/apache2/bin/httpd -k start
webservd 16691 16686   0 09:58:08 ?           0:00 /usr/apache2/bin/httpd -k start
    root 16686     1   2 09:58:07 ?           0:00 /usr/apache2/bin/httpd -k start
webservd 16688 16686   0 09:58:08 ?           0:00 /usr/apache2/bin/httpd -k start
webservd 16687 16686   0 09:58:08 ?           0:00 /usr/apache2/bin/httpd -k start

2 thoughts on “The power of the SMF Apache2 service”

  1. If your webroot is nfs mounted, smf will hang because there is no dependency for nfs.

    You need to modify the apache2.xml manifest file with this addition:

    Then reimport the manifest:
    svccfg validate apache2.xml
    svccfg import apache2.xml

  2. I guess xml syntax isn’t allowed:

    If your webroot is nfs mounted, smf will hang because there is no dependency for nfs.

    You need to modify the apache2.xml manifest file with this addition:
    <dependency name=’virtual’
    grouping=’require_all’
    restart_on=’error’
    type=’service’>
    <service_fmri value=’svc:/network/nfs/client:default’/>
    </dependency>

    Then reimport the manifest:
    svccfg validate apache2.xml
    svccfg import apache2.xml

Leave a Reply

Your email address will not be published. Required fields are marked *