8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-25 04:43:03 +01:00
firebird-mirror/builds/install/arch-specific/freebsd/firebird_daemon_startup_script.in

57 lines
1.1 KiB
Bash

#!/bin/sh
#
# $FreeBSD: ports/databases/firebird25-server/files/firebird.in,v 1.1 2010/12/20 08:48:54 acm Exp $
#
# PROVIDE: firebird
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
. /etc/rc.subr
FIREBIRD=@FB_CONFDIR@
export FIREBIRD
name=firebird
rcvar=`set_rcvar`
firebird_enable=YES # don't change - if script is installed, it's supposed to start
firebird_pidfile="/var/run/${name}.pid"
firebird_user=firebird
command_args="-daemon -forever"
command=@FB_SBINDIR@/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()
{
sleep 1 # Give fbguard time to exec after fork
# This avoids getting 2 pids in firebird_pidfile
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"