Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- root@unix:/usr/local/etc/rc.d # less vboxwebsrv
- #!/bin/sh
- # $FreeBSD: emulators/virtualbox-ose/files/vboxwebsrv.in 300896 2012-07-14 13:54:48Z beat $
- #
- # PROVIDE: vboxwebsrv
- # REQUIRE: LOGIN
- # KEYWORD: shutdown
- #
- # Add the following line to /etc/rc.conf[.local] to enable vboxwebsrv
- #
- # vboxwebsrv_enable (bool): Set to "NO" by default.
- # Set it to "YES" to enable vboxwebsrv.
- # vboxwebsrv_user (str): User account to run with.
- # vboxwebsrv_flags (str): Custom flags for vboxwebsrv.
- . /etc/rc.subr
- name=vboxwebsrv
- rcvar=vboxwebsrv_enable
- command="/usr/local/bin/vboxwebsrv"
- command_args="-H 127.0.0.1"
- pidfile="/var/run/${name}.pid"
- start_cmd="${name}_start"
- vboxwebsrv_start()
- {
- local pid
- HOME=$(/usr/sbin/pw usershow -7 -n "${vboxwebsrv_user}" | /usr/bin/cut -d: -f6)
- pid=$(check_pidfile $pidfile $command)
- if [ -n "${pid}" ]; then
- echo "${name} already running? (pid=${pid})."
- return 1
- fi
- echo -n "Starting ${name}"
- /usr/bin/install -o ${vboxwebsrv_user} -g wheel -m 644 /dev/null ${pidfile}
- /usr/sbin/daemon -f -p ${pidfile} -u ${vboxwebsrv_user} ${command} ${vboxwebsrv_flags}
- echo '.'
- }
- load_rc_config $name
- : ${vboxwebsrv_enable="NO"}
- : ${vboxwebsrv_user="vboxusers"}
- run_rc_command "$1"
Advertisement
Add Comment
Please, Sign In to add comment