diff options
author | n-connect <[email protected]> | 2023-03-02 13:44:13 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2023-03-02 13:44:13 +0100 |
commit | 2f4235a968690bc988118e88c7898948e04a7cc1 (patch) | |
tree | 4dcd0ce974a6f2913b9851574b0d87f18fd0c3f2 /rcd | |
parent | fe805e85541531cca1bc7ecf561d4cb4af7b5b5d (diff) | |
download | rustdesk-server-2f4235a968690bc988118e88c7898948e04a7cc1.tar.gz rustdesk-server-2f4235a968690bc988118e88c7898948e04a7cc1.zip |
Create rustdesk-hbbr
FreeBSD rcd script running hbbr as service. Service user, group, pid, running directory handled.
Diffstat (limited to 'rcd')
-rw-r--r-- | rcd/rustdesk-hbbr | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/rcd/rustdesk-hbbr b/rcd/rustdesk-hbbr new file mode 100644 index 0000000..ccdf719 --- /dev/null +++ b/rcd/rustdesk-hbbr @@ -0,0 +1,55 @@ +#!/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="-f -p ${pidfile} /usr/bin/env ${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 7et nonu +0 ${rustdesk_hbbr_chdir}; + chown ${rustdesk_hbbr_user}:${rustdesk_hbbr_group} ${rustdesk_hbbr_chdir}; + fi +} |