summaryrefslogtreecommitdiff
path: root/databases/percona-orchestrator/files/percona-orchestrator.in
blob: 28ee4b357b3330e6b8f1627d9b4a5186ad808b95 (plain) (blame)
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
#!/bin/sh

# PROVIDE: percona_orchestrator
# REQUIRE: LOGIN mysql
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# percona_orchestrator_enable (bool):          Set to NO by default.
#               Set it to YES to enable percona_orchestrator.
# percona_orchestrator_user (string):          Set user that percona_orchestrator will run under
#               Default is "percona".
# percona_orchestrator_group (string):         Set group that percona_orchestrator will run under
#               Default is "percona".
# percona_orchestrator_config (string):        Set path to config file
#               Default is "%%ETCDIR%%/orchestrator.cfg".
# percona_orchestrator_args (string):          Set extra arguments to pass to percona_orchestrator
#               Default is "".

. /etc/rc.subr

name=percona_orchestrator
rcvar=percona_orchestrator_enable

load_rc_config $name

: ${percona_orchestrator_enable:="NO"}
: ${percona_orchestrator_user:="percona"}
: ${percona_orchestrator_group:="percona"}
: ${percona_orchestrator_config:="%%ETCDIR%%/orchestrator.conf"}
: ${percona_orchestrator_args:=""}
: ${percona_orchestrator_restart_delay:="10"}


pidfile="/var/run/orchestrator/orchestrator.pid"
command="/usr/sbin/daemon"
percona_orchestrator_command="%%PREFIX%%/sbin/orchestrator"
command_args="-rP ${pidfile} -S -R ${percona_orchestrator_restart_delay} \
    -T ${name} ${percona_orchestrator_command} \
    -config ${percona_orchestrator_config} \
    ${percona_orchestrator_args} http"
required_files="${percona_orchestrator_config}"

start_precmd=percona_start_precmd

percona_start_precmd () {
        local piddir
        piddir=`/usr/bin/dirname "${pidfile}"`
        if [ ! -d "${piddir}" ] ; then
                /usr/bin/install -d -o "${percona_orchestrator_user}" -g "${percona_orchestrator_group}" "${piddir}"
        fi
}

load_rc_config $name
run_rc_command "$1"