aboutsummaryrefslogtreecommitdiffstats
path: root/www/mattermost-server/files/mattermostd.in
blob: 32a66b98d6eadee0e50a8a5e6fb1c24b301f1b2e (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
# $FreeBSD$

# 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 influxd
#               Default: NO
# mattermostd_conf (str):       influxd configuration file
#               Default: ${PREFIX}/etc/mattermostd.conf
# mattermostd_user (str):       influxd daemon user
#               Default: mattermostd
# mattermostd_group (str):      influxd daemon group
#               Default: mattermostd
# mattermostd_flags (str):      Extra flags passed to influxd
#
# 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_flags:="--disableconfigwatch"}
: ${mattermostd_facility:="daemon"}
: ${mattermostd_priority:="info"}
: ${mattermostd_tag:="mattermostd"}
: ${mattermostd_conf:="%%PREFIX%%/etc/mattermost/config.json"}
: ${mattermostd_options:="${mattermostd_flags} --config=${mattermostd_conf}"}

# daemon
mattermostd_pidfile="/var/run/${name}.pid"
procname="%%PREFIX%%/bin/${name}"
command=/usr/sbin/daemon
start_cmd="mattermostd_startcmd_daemon"

mattermostd_startcmd_daemon()
{
    echo "Starting ${name}."
    cd /usr/local/www/mattermost && \
        /usr/sbin/daemon -p ${mattermostd_pidfile} -S -s ${mattermostd_priority} -l ${mattermostd_facility} -T ${mattermostd_tag} \
        -u ${mattermostd_user} ${procname} ${mattermostd_options}
}

run_rc_command "$1"