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 start
I 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-james
As 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_HOME
CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar
case "$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.xml
As 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: [email protected]
-->
<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.xml
Then I ran the command:
svccfg import ./james.xml
with the file successfully validated and imported I ran:
svcadm enable james
and tested with:
telnet localhost 25
The 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