Last active
September 20, 2017 12:57
-
-
Save sistematico/6ab34cb4ab451e83572e9b4062c421d1 to your computer and use it in GitHub Desktop.
ShoutCast + sc_trans Init Script para Debian & Arch Linux(modificações necessárias)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Este arquivo deve ficar em /home/radio/config.cfg ou qualquer outro PATH que desejar... | |
# As variaveis aqui contidas já existem no script /etc/init.d/shoutcas porem serão sobre-escritas se você preferir. | |
# Diretórios não pesquisados durante a criação da lista | |
EXCLUDE="Vinhetas|Amado Batista|Barrerito" | |
# Shoutcast Vars | |
#HOME="/home/radio" | |
#SHOUT_HOME="/home/radio/shoutcast" | |
#SHOUT_PID=$(pidof sc_serv) | |
#USER="radio" | |
#DESC="Shoutcast Stream" | |
#NAME="shoutcast" | |
#SCRIPTNAME="/etc/init.d/$NAME" | |
# sc_trans Vars | |
#TRANS_HOME="/home/radio/transcoder" | |
#TRANS_PID=$(pidof sc_trans) | |
#TRANS_FIND=$(which find) | |
#TRANS_CHOWN=$(which chown) | |
#TRANS_PATH="/usr/local/musicas" # Lembre-se de dar um chown -R radio:radio | |
#TRANS_VINHETAS_PATH="/usr/local/musicas/Vinhetas" | |
#TRANS_LIST="${TRANS_HOME}/playlists/principal.lst" | |
#TRANS_VINHETAS_LIST="${TRANS_HOME}/playlists/jingles.lst" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: sc_serv | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: startscript sc_serv | |
# Description: startscript for sc_serv (DNASv2) | |
### END INIT INFO | |
# Author: Lucas Saliés Brum <[email protected]> | |
# Shoutcast Vars | |
HOME="/home/radio" | |
SHOUT_HOME="/home/radio/shoutcast" | |
SHOUT_PID=$(pidof sc_serv) | |
USER="radio" | |
DESC="Shoutcast Stream" | |
NAME="shoutcast" | |
SCRIPTNAME="/etc/init.d/$NAME" | |
# Arquivo de configuração separado? | |
CONFIG="${HOME}/config.cfg" | |
# Diretórios não pesquisados durante a criação da lista | |
EXCLUDE="Vinhetas|Amado Batista|Barrerito" | |
# sc_trans Vars | |
TRANS_HOME="/home/radio/transcoder" | |
TRANS_PID=$(pidof sc_trans) | |
TRANS_FIND=$(which find) | |
TRANS_CHOWN=$(which chown) | |
TRANS_PATH="/usr/local/musicas" # Lembre-se de dar um chown -R radio:radio | |
TRANS_VINHETAS_PATH="/usr/local/musicas/Vinhetas" | |
TRANS_LIST="${TRANS_HOME}/playlists/principal.lst" | |
TRANS_VINHETAS_LIST="${TRANS_HOME}/playlists/jingles.lst" | |
if [ -f $CONFIG ]; then | |
. $CONFIG | |
fi | |
do_start() | |
{ | |
su $USER -c "cd $SHOUT_HOME; ./sc_serv daemon ./sc_serv.conf" | |
su $USER -c "cd $TRANS_HOME; ./sc_trans ./sc_trans_sdm.conf 2> /dev/null 1> /dev/null &" | |
} | |
do_stop() | |
{ | |
#cd $SHOUT_HOME; kill -9 `cat sc_serv_8000.pid` | |
pkill -9 sc_serv | |
pkill -9 sc_trans | |
} | |
do_refresh() | |
{ | |
su $USER -c "$TRANS_FIND $TRANS_PATH -iname \"*.mp3\" | egrep -v \"${EXCLUDE}\" > $TRANS_LIST" | |
su $USER -c "$TRANS_FIND $TRANS_VINHETAS_PATH -iname \"*.mp3\" > $TRANS_VINHETAS_LIST" | |
pkill -SIGUSR1 sc_trans | |
} | |
case "$1" in | |
start) | |
echo "Starting $DESC $NAME" | |
do_start | |
;; | |
stop) | |
echo "Stopping $DESC $NAME" | |
do_stop | |
;; | |
refresh) | |
echo "Refreshing $DESC $NAME" | |
do_refresh | |
;; | |
restart) | |
echo "Stopping $DESC $NAME" | |
do_stop | |
echo "Starting $DESC $NAME" | |
do_start | |
;; | |
*) | |
echo "Usage: $SCRIPTNAME {start|stop|refresh|restart}" | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment