literal name_enable wherever possible, and ${name}_enable when it's not, to prepare for the demise of set_rcvar(). In cases where I had to hand-edit unusual instances also modify formatting slightly to be more uniform (and in some cases, correct). This includes adding some $FreeBSD$ tags, and most importantly moving rcvar= to right after name= so it's clear that one is derived from the other.
62 lines
1.2 KiB
Bash
62 lines
1.2 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
# PROVIDE: firebird
|
|
# REQUIRE: LOGIN
|
|
# KEYWORD: shutdown
|
|
#
|
|
# Add the following line to /etc/rc.conf to enable Firebird Database:
|
|
#
|
|
# firebird_enable: Set it to "YES" to enable firebird.
|
|
# Default is "NO".
|
|
# firebird_flags: Set options to run fbguard.
|
|
# Default is "-daemon".
|
|
# firebird_pidfile: Set full path to pid file.
|
|
# Default is "/var/run/firebird.pid".
|
|
#
|
|
|
|
. /etc/rc.subr
|
|
|
|
name=firebird
|
|
rcvar=firebird_enable
|
|
|
|
load_rc_config $name
|
|
|
|
firebird_enable=${firebird_enable:-"NO"}
|
|
firebird_flags=${firebird_flags:-"-daemon"}
|
|
firebird_pidfile=${firebird_pidfile:-"/var/run/${name}.pid"}
|
|
firebird_user=firebird
|
|
|
|
command_args="${firebird_flags}"
|
|
command=%%PREFIX%%/bin/fbguard
|
|
pidfile=${firebird_pidfile}
|
|
start_precmd="start_precmd"
|
|
start_postcmd="start_postcmd"
|
|
stop_postcmd=stop_postcmd
|
|
reload_postcmd=reload_postcmd
|
|
|
|
start_precmd()
|
|
{
|
|
touch ${firebird_pidfile}
|
|
chown "${firebird_user}:wheel" ${firebird_pidfile} ||
|
|
err 1 "Cannot chown ${firebird_pidfile}"
|
|
}
|
|
|
|
start_postcmd()
|
|
{
|
|
pgrep -u ${firebird_user} fbguard > ${firebird_pidfile}
|
|
}
|
|
|
|
stop_postcmd()
|
|
{
|
|
rm -f ${pidfile}
|
|
}
|
|
|
|
reload_postcmd()
|
|
{
|
|
rm -f ${pidfile}
|
|
run_rc_command start
|
|
}
|
|
|
|
run_rc_command "$1"
|