blob: 906d45e8ccca022df98ee4fc317fac3581d0caf8 (
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
62
63
64
|
#!/bin/sh
# PROVIDE: rustdesk_hbbr
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# rustdesk_hbbr_enable (bool): Set to NO by default.
# Set it to YES to enable nfs-exporter.
# rustdesk_hbbr_args (string): Set extra arguments to pass to nfs-exporter
# Default is "".
# rustdesk_hbbr_user (string): Set user that rustdesk_hbbr will run under
# Default is "root".
# rustdesk_hbbr_group (string): Set group that rustdesk_hbbr will run under
# Default is "wheel".
. /etc/rc.subr
name=rustdesk_hbbr
desc="Rustdesk Relay Server"
rcvar=rustdesk_hbbr_enable
load_rc_config $name
: ${rustdesk_hbbr_enable:=NO}
: ${rustdesk_hbbr_args:=""}
: ${rustdesk_hbbr_user:=rustdesk}
: ${rustdesk_hbbr_group:=rustdesk}
pidfile=/var/run/rustdesk_hbbr.pid
command=/usr/sbin/daemon
procname=/usr/local/sbin/hbbr
rustdesk_hbbr_chdir="/var/lib/rustdesk-server/"
rustdesk_hbbr_args="-k _"
command_args="-p ${pidfile} -o /var/log/rustdesk-hbbr.log ${procname} ${rustdesk_hbbr_args}"
start_precmd=rustdesk_hbbr_startprecmd
rustdesk_hbbr_startprecmd()
{
if [ -e ${pidfile} ]; then
chown ${rustdesk_hbbr_user}:${rustdesk_hbbr_group} ${pidfile};
else
install -o ${rustdesk_hbbr_user} -g ${rustdesk_hbbr_group} /dev/null ${pidfile};
fi
if [ -e ${rustdesk_hbbr_chdir} ]; then
chown -R ${rustdesk_hbbr_user}:${rustdesk_hbbr_group} ${rustdesk_hbbr_chdir};
chmod -R 770 ${rustdesk_hbbr_chdir};
else
mkdir -m 770 ${rustdesk_hbbr_chdir};
chown ${rustdesk_hbbr_user}:${rustdesk_hbbr_group} ${rustdesk_hbbr_chdir};
fi
if [ -e /var/log/rustdesk-hbbr.log ]; then
chown -R ${rustdesk_hbbr_user}:${rustdesk_hbbr_group} /var/log/rustdesk-hbbr.log;
chmod 660 /var/log/rustdesk-hbbr.log;
else
install -o ${rustdesk_hbbr_user} -g ${rustdesk_hbbr_group} /dev/null /var/log/rustdesk-hbbr.log;
chmod 660 /var/log/rustdesk-hbbr.log;
fi
}
run_rc_command "$1"
|