blob: b5873ac657bc13a4ab2e253b8cfb1d8b73d29b93 (
about) (
plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
#!/bin/sh
# $Id$
# ---------------------------------------------------------------------------
#
# /etc/rc.d/rc.icecast
# This shell script takes care of starting and stopping
# the icecast server, plus the "ices" source client.
# Author:
# Eric Hameleers <alien@slackware.com>
#
[ -x /usr/bin/icecast ] || exit 0
start() {
# Start daemons.
echo -n "Starting icecast: /usr/bin/icecast -c /etc/icecast/icecast.xml "
if [ ! -f /etc/icecast/icecast.xml ]; then
echo "... configuration file not found!"; exit 0
fi
/usr/bin/icecast -b -c /etc/icecast/icecast.xml
echo
if [ -x /usr/bin/ices ]; then
sleep 3
echo -n "Starting ices: /usr/bin/ices -v "
/usr/bin/ices -v
echo
fi
}
stop() {
# Stop daemons.
if [ -x /usr/bin/ices ]; then
echo -n "Shutting down ices: "
killall -TERM ices
fi
echo -n "Shutting down icecast: "
# Rude: killall -TERM
killall -TERM icecast
echo
}
status() {
PIDS1=$(pidof icecast)
PIDS2=$(pidof ices)
if [ "x$PIDS1" = "x" ]; then
echo "icecast is not running!"
else
echo "icecast is running at pid(s) ${PIDS1}."
fi
if [ "x$PIDS2" = "x" ]; then
echo "ices is not running!"
else
echo "ices is running at pid(s) ${PIDS2}."
fi
}
current() {
if [ -f /var/state/ices/ices.cue ]; then
desc=("Filename: " \
"Filesize: " \
"Bitrate: " \
"Playing time: " \
"% elapsed: " \
"Ices index: " \
"Artist: " \
"Song Title: ")
index=0
while read cueline; do
echo "${desc[$index]} $cueline"
index=$(expr $index + 1)
done < /var/state/ices/ices.cue
else
echo "I found no running 'ices' icecast source client!"
fi
}
next() {
if [ ! -f /var/state/ices/ices.pid ]; then
echo "Can't skip to next track... can't find ices source client."
else
echo "Skipping to next track in playlist..."
kill -USR1 $(cat /var/state/ices/ices.pid)
fi
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 2
start
;;
status)
status
;;
next)
next
;;
current)
current
;;
*)
echo $"Usage: $0 {start|stop|restart|status|current|next}"
;;
esac
exit 0
|