#!/bin/sh # PROVIDE: aprsd # REQUIRE: NETWORKING # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf # aprsd_enable="YES" # aprsd_root="YES" or aprsd_root="NO" . /etc/rc.subr name=aprsd rcvar=aprsd_enable load_rc_config $name : ${aprsd_enable=NO} : ${aprsd_root=NO} : ${aprsd_user=%%APRSD_RC_USER%%} : ${aprsd_group=%%APRSD_RC_GROUP%%} command=%%LOCALBASE%%/bin/aprsd start_precmd=aprsd_pre stop_cmd=aprsd_stop pidfile=/var/run/aprsd.pid aprsd_pre() { if [ ${aprsd_root} != "YES" ]; then echo "Starting aprs server as user ${aprsd_user}:${aprsd_group}." install -o ${aprsd_user} -g ${aprsd_group} /dev/null ${pidfile} chown -R ${aprsd_user}:${aprsd_group} /var/log/aprsd else echo "Starting aprs server as root." install -o root -g wheel /dev/null ${pidfile} chown -R root:wheel /var/log/aprsd fi return 0 } run_rc_command "$1"