freebsd-ports/sysutils/sd-agent/files/sd-agent.in
Matthew Seaman 79260ee9b5 New port: sd-agent
Server Density Agent for FreeBSD

Monitor CPU, memory, disk usage, network, Apache, MySQL + more via the
ServerDensity platform.

WWW: https://www.serverdensity.com/
2014-10-24 16:02:32 +00:00

50 lines
850 B
Bash

#!/bin/sh
# PROVIDE: %%RCNAME%%
# REQUIRE: LOGIN
# KEYWORD: shutdown
. /etc/rc.subr
name=%%RCNAME%%
rcvar=%%RCNAME%%_enable
pidfile="/var/run/sd-agent/sd-agent.pid"
logfile="/var/log/sd-agent/sd-agent.log"
start_precmd="${name}_prestart"
start_cmd="${name}_start"
stop_cmd="${name}_stop"
status_cmd="${name}_status"
load_rc_config $name
: ${%%RCNAME%%_enable:=no}
%%RCNAME%%_user=sd-agent
%%RCNAME%%_group=sd-agent
command='%%PREFIX%%/libexec/sd-agent/agent.py'
%%RCNAME%%_prestart()
{
install -d -o ${%%RCNAME%%_user} -g ${%%RCNAME%%_group} \
$(dirname $pidfile)
install -d -o ${%%RCNAME%%_user} -g ${%%RCNAME%%_group} \
$(dirname $logfile)
}
%%RCNAME%%_start()
{
su -m ${%%RCNAME%%_user} -c "$command start init"
}
%%RCNAME%%_stop()
{
$command stop init
}
%%RCNAME%%_status()
{
$command status init
}
run_rc_command "$1"