blob: e9e2766ddeb8e392b85e0e599ca83b46c09a3d03 (
plain)
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
57
58
59
60
61
|
#!/bin/sh
# PROVIDE: mattermostd
# REQUIRE: DAEMON NETWORKING
# BEFORE: LOGIN
# KEYWORD: shutdown
# Add the following lines to /etc/rc.conf to enable mattermostdb:
# mattermostd_enable="YES"
#
# mattermostd_enable (bool): Set to YES to enable mattermostd
# Default: NO
# mattermostd_conf (str): mattermostd configuration file
# Default: ${PREFIX}/etc/mattermostd.conf
# mattermostd_user (str): mattermostd daemon user
# Default: mattermostd
# mattermostd_group (str): mattermostd daemon group
# Default: mattermostd
# mattermostd_extraflags (str): Extra flags passed to mattermostd
# Default: --disableconfigwatch
# mattermostd_facility (str): Syslog facility to use
# Default: daemon
# mattermostd_priority (str): Syslog priority to use
# Default: info
. /etc/rc.subr
name="mattermostd"
rcvar=mattermostd_enable
load_rc_config $name
: ${mattermostd_enable:="NO"}
: ${mattermostd_user:="mattermost"}
: ${mattermostd_group:="mattermost"}
: ${mattermostd_extraflags:="--disableconfigwatch"}
: ${mattermostd_facility:="daemon"}
: ${mattermostd_priority:="info"}
: ${mattermostd_tag:="mattermostd"}
: ${mattermostd_conf:="%%PREFIX%%/etc/mattermost/config.json"}
# daemon
pidfile=/var/run/${name}.pid
procname=%%PREFIX%%/bin/${name}
command=/usr/sbin/daemon
command_args="-p ${pidfile} -S -s ${mattermostd_priority} -l ${mattermostd_facility} -T ${mattermostd_tag} ${procname} server ${mattermostd_extraflags} --config=${mattermostd_conf}"
start_precmd=mattermostd_startprecmd
mattermostd_chdir=%%PREFIX%%/www/mattermost
required_files=${mattermostd_confg}
mattermostd_startprecmd()
{
if [ ! -e ${pidfile} ]; then
install -o ${mattermostd_user} -g ${mattermostd_group} /dev/null ${pidfile};
fi
if [ ! -d ${mattermostd_dir} ]; then
install -d -o ${mattermostd_user} -g ${mattermostd_group} ${mattermostd_dir}
fi
}
run_rc_command "$1"
|