Opensolaris : SMF and Squid

Decided to create a SMF manifest for squid so that it autostarts on boot.

Command to start squid : /usr/squid/sbin/squid 

Command to stop squid : /usr/squid/sbin/squid -k shutdown 

This site has a good starter on SMF creation : http://blogs.sun.com/observatory/entry/mouting_windows_shares_at_startup

I’ve taken a copy of the /var/svc/manifest/network/smb/server.xml file for my squid manifest and placed it at /var/svc/manifest/network/squid/squid.xml

Import the XML using this command; 

svccfg import /var/svc/manifest/network/squid/squid.xml 

Update: i’ve stopped this work as i missed the fact that squid already comes with a SMF manifest! :)  No idea how i missed that one. You can enable via ; 

svcadm enable svc:/network/http:squid

This is the manifest for the above service; 

 

 

<service_bundle type=‘manifest’ name=‘SUNWsquidr:squid’>

 

<service

name=‘network/http’

type=‘service’

version=‘1’>

 

 

<dependency name=‘network’

   grouping=‘require_all’

   restart_on=‘error’

   type=‘service’>

   <service_fmri value=‘svc:/milestone/network:default’/>

 

<dependency name=‘filesystem-local’

   grouping=‘require_all’

   restart_on=‘none’

   type=‘service’>

   <service_fmri

value=‘svc:/system/filesystem/local:default’/>

 

<dependency name=‘autofs’

   grouping=‘optional_all’

   restart_on=‘error’

   type=‘service’>

   <service_fmri

value=‘svc:/system/filesystem/autofs:default’/>

 

<exec_method

type=‘method’

name=‘start’

exec=’/lib/svc/method/http-squid start’

timeout_seconds=‘60’ />

 

<exec_method

type=‘method’

name=‘stop’

exec=’/lib/svc/method/http-squid stop’

timeout_seconds=‘60’ />

 

<property_group name=‘startd’ type=‘framework’>

<propval name=‘ignore_error’ type=‘astring’

value=‘core,signal’ />

</property_group>

 

        

 

        

 

</service_bundle>