/etc/rc.d/init.d/rsync になるスクリプトを書く。 cpufreqd の SRPM を真似て *1 、 rc.rsync という名前にする。
内容については、 /etc/rc.d/init.d/rskkserv *2 と、 Debian sarge の /etc/init.d/rsync を参考にする。というかパクる。なお、 /etc/xinetd.d/rsync になるファイル (~/rpm/SOURCES/rsync.xinetd) はほとんど参考にならない。
rc.rsync の内容は次のようにした。 chkconfig: の行は適当。 see chkconfig(8) for more information.
#!/bin/sh # chkconfig: - 90 12 # description: The rsync server is a good addition to am ftp server, as it \ # allows crc checksumming etc. # Source function library. . /etc/init.d/functions RSYNC=/usr/bin/rsync RSYNC_OPTS='' RSYNC_CONFIG_FILE=/etc/rsyncd.conf RSYNC_PID_FILE=/var/run/rsyncd.pid [ -x $RSYNC ] || exit 0 case "$1" in start) echo -n "Starting rsync: " if [ ! -s "$RSYNC_CONFIG_FILE" ]; then echo "missing or empty config file $RSYNC_CONFIG_FILE" exit 1 fi $RSYNC --no-detach --daemon --config "$RSYNC_CONFIG_FILE" $RSYNC_OPTS echo ;; stop) echo -n "Shutting down rsync: " kill -9 `cat $RSYNC_PID_FILE` rm -f $RSYNC_PID_FILE echo ;; reload) echo "Reloading rsync daemon: not needed, as the daemon" echo "re-reads the config file whenever a client connects." ;; restart) $0 stop $0 start ;; *) echo "Usage: rsync {start|stop|reload}" exit 1 esac exit 0
rc.rsync は ~/rpm/SOURCES に置く。 ~/rpm/SOURCES/rsync.xinetd は要らないので削除する。 rc.rsync には実行属性を付けておこう。
$ chmod 755 rc.rsync
rsync を daemon として動かすには、設定ファイル rsyncd.conf が必要なんだけど、 Vine Linux のシステム上にも tarball の中にも無いみたい。なので、 FreeBSD 4.10 から /usr/local/etc/rsyncd.conf.sample をパチってくる *3。 /usr/share/doc/rsync-2.6.3/ とかに配置することになるだろう。
$ scp username@host.powerd.by.freebsd:/usr/local/etc/rsyncd.conf.sample ~/rpm/SOURCES