Rhys Black
Mon, 26 Oct 2009 01:20:53 -0700
~Rhys david.moss wrote:
Recently I asked the list if anyone had installed James on Solaris 10 under the SMF system. Getting no replies I set about doing it myself. I was successful.First I extracted the James files into /opt/james-2.3.2 and tested it with a manual start using /opt/james-2.3.2/bin/phoenix.sh startI found I had to set the JAVA_HOME variable somewhere for it to work. That's OK, I set this variable in the startup script.Next I created a file named /lib/svc/method/svc-jamesAs follows:<***begin listing of svc-james> #!/sbin/sh# Thanks to Eric MacAdie for the basis of this script: # http://www.macadie.net/opencms/opencms/sites/MacAdie.dot.Net/Java/James/010. jamesStartupScript.html. /lib/svc/share/smf_include.sh# edit JAVA_HOME to reflect your own java environment JAVA_HOME=/usr/j2se export JAVA_HOMECLASSPATH=.:$JAVA_HOME/jre/lib/rt.jarcase "$1" in 'start') /opt/james-2.3.2/bin/phoenix.sh start ;; 'stop') /opt/james-2.3.2/bin/phoenix.sh stop ;; 'restart') /opt/james-2.3.2/bin/phoenix.sh stop sleep 60 /opt/james-2.3.2/bin/phoenix.sh start ;; *) echo "Usage: $0 { start | stop | restart }" ;; esac exit 0 <***end listing of svc-james>I set permissions on this file as: -r-xr-xr-x to match the others in the directory.Next I created a file named /var/svc/manifest/network/james.xmlAs follows:<***begin listing james.xml> <?xml version='1.0'?> <!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'> <!--William Pool (Puddle) 02/05 Service manifest for MySQL E-mail: pud...@flipmotion.com --><service_bundle type='manifest' name='james:james'><service name='network/james' type='service' version='1'> <create_default_instance enabled='false' /> <single_instance /><dependency name='fs' grouping='require_all' restart_on='none' type='service'> <service_fmri value='svc:/system/filesystem/local' /> </dependency><dependency name='net' grouping='require_all' restart_on='none' type='service'> <service_fmri value='svc:/network/loopback' /> </dependency><exec_method type='method' name='start' exec='/lib/svc/method/svc-james start' timeout_seconds='-1'> <method_context working_directory='/var/james'> <method_credential user='root' group='bin' /> </method_context> </exec_method><exec_method type='method' name='stop' exec='/lib/svc/method/svc-james stop' timeout_seconds='-1'> <method_context working_directory='/var/james'> <method_credential user='root' group='bin' /> </method_context> </exec_method><exec_method type='method' name='restart' exec='/lib/svc/method/svc-james restart' timeout_seconds='-1'> <method_context working_directory='/var/james'> <method_credential user='root' group='bin' /> </method_context> </exec_method></service></service_bundle><***end listing james.xml>Next I created the directory /var/james to match the working directory in james.xml. It won't work without it.From within /var/svc/manifest/network/ I ran the command: svccfg validate ./james.xmlThen I ran the command: svccfg import ./james.xmlwith the file successfully validated and imported I ran: svcadm enable jamesand tested with: telnet localhost 25The mail server answered perfectly.I used:svcadm disable james and the mail server no longer answered using telnet.Finally I re-ran svcadm enable james and my James server now starts automatically at boot time and will self heal if anything goes wrong during runtime.Hopefully others will find this useful.David Moss
--------------------------------------------------------------------- To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org For additional commands, e-mail: server-user-h...@james.apache.org