diff options
author | Antonio Hernández Blas <hba.nihilismus@gmail.com> | 2011-12-22 23:56:54 -0600 |
---|---|---|
committer | Niels Horn <niels.horn@slackbuilds.org> | 2011-12-23 14:05:43 -0200 |
commit | f1952461b1ee94cf2b1b96ae764f67beb1d2f2e2 (patch) | |
tree | 576b1b516d0d6d9de7b9a62f183fcb830002c317 /audio/ices-cc/rc.ices-cc | |
parent | 7bf998ee43c7d4f26d1343053a745531f23c072d (diff) |
audio/ices-cc: Added (primary source client for icecast)
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'audio/ices-cc/rc.ices-cc')
-rw-r--r-- | audio/ices-cc/rc.ices-cc | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/audio/ices-cc/rc.ices-cc b/audio/ices-cc/rc.ices-cc new file mode 100644 index 0000000000000..002f6254bf2c3 --- /dev/null +++ b/audio/ices-cc/rc.ices-cc @@ -0,0 +1,80 @@ +#!/bin/sh + +# Start/stop/restart ices-cc as a daemon +# Copyright (c) 2011 Antonio Hernández Blas <hba.nihilismus@gmail.com> + +# +# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE +# Version 2, December 2004 +# +# Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> +# +# Everyone is permitted to copy and distribute verbatim or modified +# copies of this license document, and changing it is allowed as long +# as the name is changed. +# +# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE +# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +# +# 0. You just DO WHAT THE FUCK YOU WANT TO. +# + +CONF='/etc/ices-cc.conf' +BASEDIR='/var/log/ices-cc' +CMMD="/usr/bin/ices-cc -B -c $CONF -D $BASEDIR" + +ices_start() { + if [ -x /usr/bin/ices-cc ]; then + if [ -f $CONF ]; then + PIDOF=$(pgrep -f "$CMMD") + if [ ! -z "$PIDOF" ]; then + echo "Error, ices is already running as daemon." + else + echo "Starting ices as daemon: $CMMD" + /bin/su - ices -c "$CMMD" + fi + else + echo "Error, file $CONF does not exist." + fi + fi +} + +ices_stop() { + PIDOF=$(pgrep -f "$CMMD") + if [ -z $PIDOF ]; then + echo "Error, ices-cc is not running as daemon." + else + echo "Stoping ices-cc as daemon: kill -s SIGINT $PIDOF" + /bin/kill -s SIGINT $PIDOF + fi +} + +ices_status() { + PIDOF=$(pgrep -f "$CMMD") + if [ ! -z "$PIDOF" ]; then + echo "ices-cc is running as daemon." + else + echo "ices-cc is not running as daemon." + fi +} + +case $1 in + start) + ices_start + ;; + stop) + ices_stop + ;; + restart) + ices_stop + sleep 3 + ices_start + ;; + status) + ices_status + ;; + *) + echo "Usage $0 {start|stop|restart|status}" + exit 1 + ;; +esac |