summaryrefslogtreecommitdiff
path: root/www/garage/files/garage.in
blob: 60ef7deb5a8539af9874aa7ba525abaa1e33bd89 (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
#!/bin/sh

# PROVIDE: garage
# REQUIRE: NETWORKING
# KEYWORD: shutdown

# Add the following line to /etc/rc.conf.local or /etc/rc.conf to enable garage:
#
# garage_enable="YES"
#

. /etc/rc.subr

name=garage
desc="Distributed object storage"
rcvar=${name}_enable

# read configuration and set defaults
load_rc_config $name
: ${garage_enable="NO"}
: ${garage_config="%%PREFIX%%/etc/garage.toml"}
: ${garage_log_file="/var/log/garage.log"}

command=/usr/sbin/daemon
procname="%%PREFIX%%/bin/${name}"
required_files=${garage_config}
pidfile=/var/run/${name}.pid
command_args=

if [ "${garage_log_file}" = syslog ]; then
	garage_env="${garage_env} GARAGE_LOG_TO_SYSLOG=1"
else
	command_args="-o ${garage_log_file}"
fi

command_args="${command_args} -p $pidfile -H -f $procname -c ${garage_config} server"

status_cmd="$procname -c ${garage_config} status"

run_rc_command "$1"