#!/bin/sh # $FreeBSD: head/net-mgmt/netdisco/files/netdisco.in 332583 2013-11-03 04:53:54Z sunpoet $ # # PROVIDE: netdisco # REQUIRE: DAEMON LOGIN # AFTER: postgresql # KEYWORD: shutdown . /etc/rc.subr name="netdisco" rcvar="netdisco_enable" load_rc_config $name : ${netdisco_enable="NO"} : ${netdisco_user="%%NETDISCO_USER%%"} : ${netdisco_group="%%NETDISCO_GROUP%%"} start_precmd=${name}_prestart stop_cmd=${name}_stop restart_cmd=${name}_restart status_cmd=${name}_status command="%%PREFIX%%/bin/netdisco" command_interpreter="/usr/bin/perl" netdisco_config="%%ETCDIR%%/netdisco.conf" pidfile=$(grep ^daemon_pid $netdisco_config | cut -d= -f2 | tail -1) flags="-p start" required_files="$netdisco_config" netdisco_prestart() { touch $pidfile && chown $netdisco_user $pidfile test -d %%NETDISCO_DBDIR%% || install -d -m 0700 -o $netdisco_user -g $netdisco_group %%NETDISCO_DBDIR%% } netdisco_stop() { su -m "$netdisco_user" -c "$command -p stop" } netdisco_restart() { su -m "$netdisco_user" -c "$command -p restart" } netdisco_status() { su -m "$netdisco_user" -c "$command -p status" } run_rc_command "$1"