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
That’s all.
this is great. however, i can’t seem to move any files to the /lib/svc/method/ directory … i get ‘read-only file system’, even if i su to root. how did you place the script there?
i tried again, this time sitting at the console. works perfect.
Hello andy,
It’s nice to see that it did work to you. It’s strange the “read-only” filesystem error that you have described. Maybe you have misunderstood the error… anyway, if you have some doubts in that procedure, post it here, maybe i can help you or some other blog’s reader.
See ya.
Very good post, Thanks! One notice: it`s necessary to copy DTD line in any file in /var/svc/manifest/network/ to /var/svc/manifest/network/rsync.xml. )
Excellent article! Thank you very much! Exactly what I’ve been looking for.
Adorei seu blog, deixei nos meus favoritos! parabéns, quando der visite o meu blog, bjs..
Very good post . It was very useful
I get this output when i try and import the XML manifest. Any ideas ??
svc:> import /var/svc/manifest/network/rsync.xml
Restarting svc:/system/manifest-import
The manifest being imported is from a standard location and should be imported with the command : svcadm restart svc:/system/manifest-import
svc:>