2023-07-02 16:39:39 -04:00
|
|
|
#!/bin/sh
|
|
|
|
# PROVIDE: lemmy
|
2023-08-13 09:33:42 -04:00
|
|
|
# REQUIRE: NETWORKING SYSLOG DAEMON postgresql
|
2023-07-02 16:39:39 -04:00
|
|
|
#
|
|
|
|
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
|
|
|
|
# to enable this service:
|
|
|
|
#
|
|
|
|
# lemmy_enable (bool): Set to NO by default.
|
|
|
|
# Set it to YES to enable lemmy.
|
|
|
|
#
|
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
: ${lemmy_enable="NO"}
|
|
|
|
: ${lemmy_user="lemmy"}
|
|
|
|
: ${lemmy_group="lemmy"}
|
|
|
|
: ${lemmy_config="/usr/local/etc/lemmy/lemmy.hjson"}
|
|
|
|
: ${lemmy_pictrspath="/var/lib/pictrs"}
|
|
|
|
: ${lemmy_pictrsaddr="127.0.0.1:8080"}
|
|
|
|
: ${lemmy_facility:="news"}
|
|
|
|
: ${lemmy_priority:="err"}
|
|
|
|
: ${lemmy_tag:="lemmy"}
|
|
|
|
|
|
|
|
name="lemmy"
|
|
|
|
rcvar=lemmy_enable
|
|
|
|
|
|
|
|
load_rc_config $name
|
|
|
|
|
|
|
|
lemmy_pidfile="/var/run/${name}.pid"
|
|
|
|
pidfile=${lemmy_pidfile}
|
|
|
|
procname=/usr/local/lemmy/lemmy_server
|
|
|
|
command=/usr/sbin/daemon
|
|
|
|
|
|
|
|
start_cmd=lemmy_start
|
|
|
|
|
|
|
|
lemmy_start() {
|
|
|
|
echo "Starting ${name}."
|
|
|
|
cd ${lemmy_pictrspath}/..
|
|
|
|
export LEMMY_CONFIG_LOCATION=${lemmy_config}
|
|
|
|
export PICTRS_PATH=${lemmy_pictrspath}
|
|
|
|
export PICTRS_ADDR=${lemmy_pictrsaddr}
|
|
|
|
/usr/sbin/daemon -S -s ${lemmy_priority} -l ${lemmy_facility} -T ${lemmy_tag} -p ${lemmy_pidfile} -f -u $lemmy_user $procname
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
run_rc_command "$1"
|