Virtualmin RC Script for FreeBSD

February 4, 2011

Virtualmin’s in ports, but I liked it so much that we decided to buy the pro version, which of course, isn’t. Unfortunately, the latest FreeBSD version the installer script officially supports is 7.x, so I guess that’s why some of the system setup didn’t go quite as planned.

I’m happy to report that the system seems to be running fine (for a few months now), the only thing that didn’t work at all was the startup script, so I had to create one from scratch:

#!/bin/sh
#
# PROVIDE: virtualmin
# REQUIRE: LOGIN
# KEYWORD: shutdown
#

. /etc/rc.subr

name="virtualmin"
rcvar=${name}_enable

load_rc_config $name

: ${virtualmin_enable="NO"}

start_cmd=${name}_start
stop_cmd=${name}_stop
extra_commands="restart"

virtualmin_start() {
  /usr/local/etc/webmin/start
}

virtualmin_stop() {
  /usr/local/etc/webmin/stop
}

virtualmin_restart() {
  /usr/local/etc/webmin/restart
}

run_rc_command "$1"

Save that into /usr/local/etc/rc.d/virtualmin, chmod +x and set virtualmin_enable=“YES” in /etc/rc.conf.