rustdesk-hbbs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/sh
  2. # PROVIDE: rustdesk_hbbs
  3. # REQUIRE: LOGIN
  4. # KEYWORD: shutdown
  5. #
  6. # Add the following lines to /etc/rc.conf.local or /etc/rc.conf
  7. # to enable this service:
  8. #
  9. # rustdesk_hbbs_enable (bool): Set to NO by default.
  10. # Set it to YES to enable nfs-exporter.
  11. # rustdesk_hbbs_args (string): Set extra arguments to pass to nfs-exporter
  12. # Default is "".
  13. # rustdesk_hbbs_user (string): Set user that rustdesk_hbbs will run under
  14. # Default is "root".
  15. # rustdesk_hbbs_group (string): Set group that rustdesk_hbbs will run under
  16. # Default is "wheel".
  17. . /etc/rc.subr
  18. name=rustdesk_hbbs
  19. desc="Rustdesk ID/Rendezvous Server"
  20. rcvar=rustdesk_hbbs_enable
  21. load_rc_config $name
  22. : ${rustdesk_hbbs_enable:=NO}
  23. : ${rustdesk_hbbs_ip:=127.0.0.1}
  24. : ${rustdesk_hbbs_args="-r ${rustdesk_hbbs_ip} -k _"}
  25. : ${rustdesk_hbbs_user:=rustdesk}
  26. : ${rustdesk_hbbs_group:=rustdesk}
  27. pidfile=/var/run/rustdesk_hbbs.pid
  28. command=/usr/sbin/daemon
  29. procname=/usr/local/sbin/hbbs
  30. rustdesk_hbbs_chdir="/var/lib/rustdesk-server/"
  31. command_args="-p ${pidfile} -o /var/log/rustdesk-hbbs.log ${procname} ${rustdesk_hbbs_args}"
  32. ## If you want the daemon do its log over syslog comment out the above line and remove the comment from the below replacement
  33. #command_args="-p ${pidfile} -T ${name} ${procname} ${rustdesk_hbbs_args}"
  34. start_precmd=rustdesk_hbbs_startprecmd
  35. rustdesk_hbbs_startprecmd()
  36. {
  37. if [ -e ${pidfile} ]; then
  38. chown ${rustdesk_hbbs_user}:${rustdesk_hbbs_group} ${pidfile};
  39. else
  40. install -o ${rustdesk_hbbs_user} -g ${rustdesk_hbbs_group} /dev/null ${pidfile};
  41. fi
  42. if [ -e ${rustdesk_hbbs_chdir} ]; then
  43. chown -R ${rustdesk_hbbs_user}:${rustdesk_hbbs_group} ${rustdesk_hbbs_chdir};
  44. chmod -R 770 ${rustdesk_hbbs_chdir};
  45. else
  46. mkdir -m 770 ${rustdesk_hbbs_chdir};
  47. chown ${rustdesk_hbbs_user}:${rustdesk_hbbs_group} ${rustdesk_hbbs_chdir};
  48. fi
  49. if [ -e /var/log/rustdesk-hbbs.log ]; then
  50. chown -R ${rustdesk_hbbs_user}:${rustdesk_hbbs_group} /var/log/rustdesk-hbbs.log;
  51. chmod 660 /var/log/rustdesk-hbbs.log;
  52. else
  53. install -o ${rustdesk_hbbs_user} -g ${rustdesk_hbbs_group} /dev/null /var/log/rustdesk-hbbs.log;
  54. chmod 660 /var/log/rustdesk-hbbs.log;
  55. fi
  56. }
  57. run_rc_command "$1"