#!/bin/sh # # $FreeBSD: head/net/rsync/files/rsyncd.in 367807 2014-09-10 09:36:24Z ehaupt $ # # PROVIDE: %%NAME%% # REQUIRE: LOGIN # BEFORE: securelevel # KEYWORD: shutdown # Add the following lines to /etc/rc.conf to enable `%%NAME%%': # # %%NAME%%_enable="YES" # %%NAME%%_flags="" # # See rsync(1) for %%NAME%%_flags # . /etc/rc.subr name="%%NAME%%" rcvar=%%NAME%%_enable command="%%PREFIX%%/bin/rsync" start_precmd="%%NAME%%_precmd" pidfile="/var/run/$name.pid" # read configuration and set defaults load_rc_config "$name" : ${%%NAME%%_enable="NO"} : ${%%NAME%%_configfile:=%%ETCDIR%%/$name.conf} required_files="${%%NAME%%_configfile}" command_args="--daemon --config ${%%NAME%%_configfile}" %%NAME%%_precmd() { if [ -f "%%PREFIX%%/etc/$name.conf" ] && [ ! -L "%%PREFIX%%/etc/$name.conf" ]; then echo "Found %%PREFIX%%/etc/$name.conf in old location. Migrating to %%ETCDIR%%/$name.conf." mv %%PREFIX%%/etc/$name.conf %%ETCDIR%%/$name.conf ln -s %%ETCDIR%%/$name.conf %%PREFIX%%/etc/$name.conf fi } run_rc_command "$1"