FreeBSD rc.d script for www/garage (S3-compatible object storage)

FreeBSD rc.d script for www/garage (S3-compatible object storage)

10 September, 2023 1 min read
FreeBSD, object storage, self-hosting

Garage is an open-source distributed object storage service tailored for self-hosting, and is available on FreeBSD . Up until recently, the installed package did not provide an rc.d script, so I wrote and contributed my own:

#!/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="/usr/local/etc/garage.toml"}

command="/usr/local/bin/${name}"
required_files=${garage_config}
command_args="-c ${garage_config} server"

start_cmd="${command} -c ${garage_config} server"
stop_cmd="pkill -15 ${name}"
status_cmd="${command} status"

run_rc_command "$1"

Update (2023-09-26)

The port maintainer has included the script in version 0.8.4 .