#!/bin/sh # # Author: Mark Felder # # $FreeBSD$ # # PROVIDE: pdagentd # REQUIRE: LOGIN # KEYWORD: shutdown # Add the following lines to /etc/rc.conf to enable pdagentd: # pdagentd_enable="YES" . /etc/rc.subr name="pdagentd" rcvar=pdagentd_enable load_rc_config $name : ${pdagentd_enable="NO"} : ${pdagentd_user:="pdagent"} : ${pdagentd_group:="pdagent"} pidfile="/var/run/pdagent/pdagentd.pid" command="%%PREFIX%%/bin/pdagentd.py" start_precmd=pdagentd_precmd procname=%%PYTHON_CMD%% pdagent_mkdirs="/var/db/pdagent /var/db/pdagent/outqueue /var/db/pdagent/db /var/db/pdagent/outqueue/pdq \ /var/db/pdagent/outqueue/tmp /var/db/pdagent/outqueue/suc /var/db/pdagent/outqueue/err" pdagentd_precmd() { for i in ${pdagent_mkdirs}; do install -d -o ${pdagentd_user} -g ${pdagentd_group} -m 770 ${i} done chown -R ${pdagentd_user}:${pdagentd_group} /var/db/pdagent install -d -o ${pdagentd_user} /var/log/pdagent install -d -o ${pdagentd_user} /var/run/pdagent } run_rc_command "$1"