From 7dd812c79a7a95f375910045abac9f70a7a748bc Mon Sep 17 00:00:00 2001 From: n-connect Date: Fri, 3 Mar 2023 01:10:09 +0100 Subject: [PATCH] hbbr logging to file Logging enabled via file redirection (not syslog, as it can't tell/pass the logger program's name) --- rcd/rustdesk-hbbr | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/rcd/rustdesk-hbbr b/rcd/rustdesk-hbbr index ccdf719..906d45e 100644 --- a/rcd/rustdesk-hbbr +++ b/rcd/rustdesk-hbbr @@ -15,6 +15,7 @@ # Default is "root". # rustdesk_hbbr_group (string): Set group that rustdesk_hbbr will run under # Default is "wheel". + . /etc/rc.subr name=rustdesk_hbbr @@ -33,7 +34,7 @@ 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}" +command_args="-p ${pidfile} -o /var/log/rustdesk-hbbr.log ${procname} ${rustdesk_hbbr_args}" start_precmd=rustdesk_hbbr_startprecmd @@ -48,8 +49,16 @@ rustdesk_hbbr_startprecmd() 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}; + 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"