Deploying services through Solaris 10 SMF (RSYNC Example)
As you can see here, rsync is my partner, and for use it as a daemon in Solaris 10, we can use the “/etc/rc” scripts that still works in that OS for backward compatibility, or configure it integrated on SMF. I choose the second option…
Following this howto, we know that the needed steps are:
* Create a service manifest file.
* Create a methods script file to define the start, stop, and restart methods for the service.
* Validate and import the service manifest using svccfg(1M).
* Enable or start the service using svcadm(1M).
* Verify the service is running using svcs(1).
So, let’s do it:
First, create the manifest file for the rsync service (/var/svc/manifest/network/rsync.xml)
Second, we need create the method (like a RC script), to start/stop the rsync service. As we did put on the manifest file, the location of that file will be “/lib/svc/method/rsync“. That is really a normal RC script, and we can use a start/stop script from Debian GNU/Linux distribution, for example. You can get an example that i wrote here. If you will get the Debian version or another distro, remember that there is no start-stop-daemon on Solaris.
TIP: As in Solaris 10 we don’t have rsync in the root filesystem, our rsync binary is on “/usr/local/bin/” installed from sunfreeware.
Ok, now we can configure the “/etc/rsyncd.conf” and “/etc/rsyncd.motd” files, as well as the “/etc/default/rsync” configuration file.
We are almost there… let’s validate our manifest file, and import it using the svccfg command. For the validation process i have used the command xmllint because of that bug
# xmllint --valid /var/svc/manifest/network/rsync.xml
You can issue the “validate” command (in svc: prompt), just to make sure it is fine. If the command do not produces any output, then you will confirm that the manifest file is OK. Now import it…
# svccfg svc:> import /var/svc/manifest/network/rsync.xml svc:> quit
And the last step is enable it:
svcadm enable svc:/network/rsync
You can see if the service did work with the command:
# svcs -a | grep rsync online 14:09:25 svc:/network/rsync:default