summaryrefslogtreecommitdiff
path: root/audio/shoutcast/files/shoutcast.in
blob: 4fefd6403f46bb9b1234183e6eb3d837c9386e04 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh

# $FreeBSD$
#
# 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 "%%PREFIX%%/%%ETCDIR%%/sc_serv.conf" by default.
# shoutcast_user (str):       Set to %%SHOUTCASTUSER%% by default
# shoutcast_chdir (str):      Set to %%SHOUTCASTDIR%% by default

. /etc/rc.subr

name=shoutcast
rcvar=shoutcast_enable

load_rc_config shoutcast

: ${shoutcast_enable:="NO"}
: ${shoutcast_user:="%%SHOUTCASTUSER%%"}
: ${shoutcast_chdir:="%%SHOUTCASTDIR%%"}

command="%%PREFIX%%/sbin/sc_serv"
shoutcast_logfile="/var/log/sc_serv.log"

required_dirs="${shoutcast_chdir}"
required_files="${shoutcast_configfile:="%%PREFIX%%/%%ETCDIR%%/sc_serv.conf"}"

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

start_precmd="shoutcast_prestart"

shoutcast_prestart()
{
  touch ${shoutcast_logfile}
  chown %%SHOUTCASTUSER%%:wheel ${shoutcast_logfile}
  chmod 0640 ${shoutcast_logfile}
}

run_rc_command "$1"