Guest User

Untitled

a guest
Sep 20th, 2013
634
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. root@unix:/usr/local/etc/rc.d # less vboxwebsrv
  2. #!/bin/sh
  3.  
  4. # $FreeBSD: emulators/virtualbox-ose/files/vboxwebsrv.in 300896 2012-07-14 13:54:48Z beat $
  5. #
  6. # PROVIDE: vboxwebsrv
  7. # REQUIRE: LOGIN
  8. # KEYWORD: shutdown
  9. #
  10. # Add the following line to /etc/rc.conf[.local] to enable vboxwebsrv
  11. #
  12. # vboxwebsrv_enable (bool): Set to "NO" by default.
  13. # Set it to "YES" to enable vboxwebsrv.
  14. # vboxwebsrv_user (str): User account to run with.
  15. # vboxwebsrv_flags (str): Custom flags for vboxwebsrv.
  16.  
  17. . /etc/rc.subr
  18.  
  19. name=vboxwebsrv
  20. rcvar=vboxwebsrv_enable
  21.  
  22. command="/usr/local/bin/vboxwebsrv"
  23. command_args="-H 127.0.0.1"
  24. pidfile="/var/run/${name}.pid"
  25.  
  26. start_cmd="${name}_start"
  27.  
  28. vboxwebsrv_start()
  29. {
  30. local pid
  31.  
  32. HOME=$(/usr/sbin/pw usershow -7 -n "${vboxwebsrv_user}" | /usr/bin/cut -d: -f6)
  33. pid=$(check_pidfile $pidfile $command)
  34.  
  35. if [ -n "${pid}" ]; then
  36. echo "${name} already running? (pid=${pid})."
  37. return 1
  38. fi
  39.  
  40. echo -n "Starting ${name}"
  41. /usr/bin/install -o ${vboxwebsrv_user} -g wheel -m 644 /dev/null ${pidfile}
  42. /usr/sbin/daemon -f -p ${pidfile} -u ${vboxwebsrv_user} ${command} ${vboxwebsrv_flags}
  43. echo '.'
  44. }
  45.  
  46. load_rc_config $name
  47.  
  48. : ${vboxwebsrv_enable="NO"}
  49. : ${vboxwebsrv_user="vboxusers"}
  50.  
  51. run_rc_command "$1"
Advertisement
Add Comment
Please, Sign In to add comment