aboutsummaryrefslogtreecommitdiff
path: root/security/trezord/files/trezord.in
blob: 960d21d9b5cdbb528d3271f1c49c51637e304a7c (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
#!/bin/sh

# $FreeBSD$
#
# PROVIDE: trezord
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add these lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# trezord_enable (bool):	Set to NO by default.
#				Set it to YES to enable trezord.

. /etc/rc.subr

name=trezord
rcvar=trezord_enable

load_rc_config $name

: ${trezord_enable:="NO"}

command="%%PREFIX%%/bin/trezord-go"
command_args="-l /var/log/trezord.log"
daemon_command="/usr/sbin/daemon"
pidfile="/var/run/trezord.pid"
start_cmd="${name}_start"

trezord_start()
{
    if [ -z "$rc_fast" -a -n "$rc_pid" ]; then
        echo 1>&2 "${name} already running? (pid=$rc_pid)."
        return 1
    fi
    echo "Starting ${name}."
    /usr/sbin/daemon -p $pidfile ${command} ${command_args}
    _run_rc_postcmd
}

run_rc_command "$1"