blob: 9d14f152f12b5071937dde3e22331eb798baf10e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#!/bin/sh
# 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_mode: Set it to "superclassic" or "superserver" to enable firebird.
# Default is "superclassic".
# firebird_flags: Set options to run fbserver or fb_smp_server.
# Default is "-el /var/db/firebird".
# 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_mode=${firebird_mode:-"superclassic"}
firebird_flags=${firebird_flags:-"-el /var/db/firebird"}
firebird_pidfile=${firebird_pidfile:-"/var/run/${name}.pid"}
firebird_user=firebird
command=%%PREFIX%%/sbin/fb_smp_server
command_args="${firebird_flags} &"
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} ${command_app} > ${firebird_pidfile}
echo "Current firebird mode is $firebird_mode"
}
stop_postcmd()
{
rm -f ${pidfile}
}
reload_postcmd()
{
rm -f ${pidfile}
run_rc_command start
}
case "${firebird_mode}" in
superclassic)
command=%%PREFIX%%/sbin/fb_smp_server
command_app=fb_smp_server
;;
superserver)
command=%%PREFIX%%/sbin/fbserver
command_app=fbserver
;;
*)
warn "$firebird_mode is an invalid value for firebird_mode"
return 1
;;
esac
run_rc_command "$1"
|