rustdesk-hbbs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 rustdesk_hbbs.
  11. # rustdesk_hbbs_ip (string): Set IP address/hostname of relay server to use
  12. # Defaults to "127.0.0.1", please replace with your server hostname/IP.
  13. # rustdesk_hbbs_args (string): Set extra arguments to pass to rustdesk_hbbs
  14. # Default is "-r ${rustdesk_hbbs_ip} -k _".
  15. # rustdesk_hbbs_user (string): Set user that rustdesk_hbbs will run under
  16. # Default is "root".
  17. # rustdesk_hbbs_group (string): Set group that rustdesk_hbbs will run under
  18. # Default is "wheel".
  19. . /etc/rc.subr
  20. name=rustdesk_hbbs
  21. desc="Rustdesk ID/Rendezvous Server"
  22. rcvar=rustdesk_hbbs_enable
  23. load_rc_config $name
  24. : ${rustdesk_hbbs_enable:=NO}
  25. : ${rustdesk_hbbs_ip:=127.0.0.1}
  26. : ${rustdesk_hbbs_args="-r ${rustdesk_hbbs_ip} -k _"}
  27. : ${rustdesk_hbbs_user:=rustdesk}
  28. : ${rustdesk_hbbs_group:=rustdesk}
  29. pidfile=/var/run/rustdesk_hbbs.pid
  30. command=/usr/sbin/daemon
  31. procname=/usr/local/sbin/hbbs
  32. rustdesk_hbbs_chdir=/var/db/rustdesk-server
  33. command_args="-p ${pidfile} -o /var/log/rustdesk-hbbs.log ${procname} ${rustdesk_hbbs_args}"
  34. ## If you want the daemon to do its log over syslog, comment out the above line and remove the comment from the below replacement
  35. #command_args="-p ${pidfile} -T ${name} ${procname} ${rustdesk_hbbs_args}"
  36. start_precmd=rustdesk_hbbs_startprecmd
  37. rustdesk_hbbs_startprecmd()
  38. {
  39. if [ -e ${pidfile} ]; then
  40. chown ${rustdesk_hbbs_user}:${rustdesk_hbbs_group} ${pidfile};
  41. else
  42. install -o ${rustdesk_hbbs_user} -g ${rustdesk_hbbs_group} /dev/null ${pidfile};
  43. fi
  44. if [ -e ${rustdesk_hbbs_chdir} ]; then
  45. chown -R ${rustdesk_hbbs_user}:${rustdesk_hbbs_group} ${rustdesk_hbbs_chdir};
  46. chmod -R 770 ${rustdesk_hbbs_chdir};
  47. else
  48. mkdir -m 770 ${rustdesk_hbbs_chdir};
  49. chown ${rustdesk_hbbs_user}:${rustdesk_hbbs_group} ${rustdesk_hbbs_chdir};
  50. fi
  51. if [ -e /var/log/rustdesk-hbbs.log ]; then
  52. chown -R ${rustdesk_hbbs_user}:${rustdesk_hbbs_group} /var/log/rustdesk-hbbs.log;
  53. chmod 660 /var/log/rustdesk-hbbs.log;
  54. else
  55. install -o ${rustdesk_hbbs_user} -g ${rustdesk_hbbs_group} /dev/null /var/log/rustdesk-hbbs.log;
  56. chmod 660 /var/log/rustdesk-hbbs.log;
  57. fi
  58. }
  59. run_rc_command "$1"