[ Main Page ]

Solaris 10 tips

Solaris 10になってSMF(Service Management Facility)が採用され、管理方法が大分変わったようです。/etc/init.d/ はもう使わないのが普通なようです。

rsync DAEMONを登録

rsyncは/usr/local/binにあるとして、以下の内容を/lib/svc/method に置きます。

#!/bin/sh

# Other options appear in /etc/rsyncd.conf.
RSYNCOPTS="--daemon --bwlimit=1024"

case "$1" in
'start')
        if [ -x /usr/local/bin/rsync
        -a -f /etc/rsyncd.conf -a -f /etc/rsyncd.motd ]; then
        echo "Rsync Daemon starting."
        nice -n -20 /usr/local/bin/rsync ${RSYNCOPTS}
        fi
        ;;
'stop')
        if [ -f /var/run/rsyncd.pid ]; then
        echo "Stopping Rsync Daemon."
        kill -9 `cat /var/run/rsyncd.pid`
        else
        echo "Pid file not found.  Exitting."
        exit 1
        fi
        ;;
'reload')
        if [ -f /var/run/rsyncd.pid ]; then
        kill -HUP `cat /var/run/rsyncd.pid`
        fi
        ;;
'restart')
        /etc/init.d/rsyncd stop
        /etc/init.d/rsyncd start
        ;;
*)
        echo "Usage: /etc/init.d/rsyncd { start | stop | reload | restart }"
        ;;
esac
exit 0
      

次に、/var/svc/manifest/network/sshを参考にしてXMLを書きます。そうしたら、 このサービスを登録します。

# svccfg import ./rsyncd.xml
      

うまくいくとpromptが返ります。登録されたか確認してみます。

# svcs -a|grep rsync
maintenance       18:31:00 svc:/network/rsync:default
      

あとはonlineにすれば起動する筈です。うまく行かなかったら、一旦disableにしてからenableにすればよいでしょう。 困ってしまったら再起動ですが、まずないはずです。

# svcadm enable rsync
# svcs -a|grep rsync
online         18:34:31 svc:/network/rsync:default
    

Securityにもっと気を付けるのであれば、rsyncはそれほど安全とはまだ言い難い面もあるので、zoneを利用して閉じ込める方法なども ある筈ですが、ここでは触れません。

 <rindolf>  sussman's been idle for 15 minutes.
 <rindolf>  And I need to talk to him.
 <rindolf>  sussman, oh sussman! Where art thou, sussman?
 <rindolf>  Or is it "wherefore"?
 <arild_f>  The shakespearian version is "wherefore", IIRC
 <rindolf>  Where have all the sussmans gone? (Long time passing)
 <rindolf>  Where have all the sussmans gone? (Long time ago)
 <rindolf>  Where have all the sussmans gone? They've been idle, everyone.
 <rindolf>  When will they ever learn?
 <rindolf>  When will they ever learn?

    -- #svn, Freenode

 <sussman>  ghudson: what OS did you compile the tarball on?
 <ghudson>  Red Hat 9.
 <sussman>  me too, hm.
         *  sussman wishes he were still using freebsd, for diversity's
            sake
         *  fitz wishes sussman were a chocolate cake
    <fitz>  mmmm... cake...

    -- #svn, Freenode


Powered by UNIX fortune(6)
[ Main Page ]