#!/bin/sh

# $FreeBSD: audio/shoutcast/files/shoutcast.in 300895 2012-07-14 12:56:14Z beat $
#
# PROVIDE: shoutcast
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable SHOUTcast:
# shoutcast_enable (bool):    Set to "NO" by default.
#                             Set it to "YES" to enable SHOUTcast.
# shoutcast_configfile (str): Set to "/usr/local/etc/shoutcast/sc_serv.conf" by default.
# shoutcast_user (str):       Set to "shoutcast" by default.
# shoutcast_chdir (str):      Set to "/var/run/shoutcast" by default.

. /etc/rc.subr

name=shoutcast
rcvar=shoutcast_enable

load_rc_config ${name}

: ${shoutcast_enable:="NO"}
: ${shoutcast_configfile:="/usr/local/etc/shoutcast/sc_serv.conf"}
: ${shoutcast_user:="shoutcast"}
: ${shoutcast_chdir:="/var/run/shoutcast"}

command="/usr/local/sbin/sc_serv"

required_dirs="${shoutcast_chdir}"
required_files="${shoutcast_configfile}"

command_args="${shoutcast_configfile} >/dev/null 2>&1 &"

run_rc_command "$1"
