#!/bin/sh # PROVIDE: awful # REQUIRE: DAEMON # KEYWORD: shutdown # This is a FreeBSD rc.d script to launch awful-main applications as services. . /etc/rc.subr name="awful" rcvar="awful_enable" load_rc_config "$name" awful_main=${awful_main:="/usr/local/www/main"} awful_path=${awful_path:="/usr/local/www/static"} awful_user=${awful_user:="www"} awful_port=${awful_port:="8080"} awful_args=${awful_args:=""} pidfile=/var/run/awful.pid procname=${awful_main} command=/usr/sbin/daemon command_args="-p ${pidfile} -u ${awful_user} ${procname} --port=${awful_port} --web-root=${awful_path} --access-log=${awful_path}/../access.log --error-log=${awful_path}/../error.log" if [ -n "${awful_args}" ]; then command_args="${command_args} --args ${awful_args}" fi # The main script handles dropping privileges by itself via "-u ${awful_user}", we unset # "awful_user" here to prevent run_rc_command from running it as "su -m $awful_user". unset awful_user run_rc_command "$1"