3 DIR=$(dirname $(readlink -f $0))
5 ICE_PORT=${ICEPORT:-8001}
6 MPD_PORT=${MPDPORT:-6601}
7 LISTEN=${LISTEN:-127.0.0.1}
10 #set -o xtrace -o nounset
12 IS_RUNNING=$(docker inspect --format='{{.State.Running}}' sima 2>&1)
28 docker exec -ti sima /usr/bin/tail -F /var/log/icecast2/access.log /var/log/icecast2/error.log
32 # Build image with icecast
33 docker build -t kaliko/sima ${DIR}/sima
37 _is_running && docker logs -f sima
41 _is_running && docker stop -t 3 sima
46 _is_running || { echo "No running container detected!"; exit 1; }
47 docker port sima | awk '$1 ~ /^8000\/tcp.*/ { printf "# HTTP running on: http://%s\n", $3 }'
48 if [ $arg = "false" ];then
49 docker port sima | awk -F: '$1 ~ /^6600\/tcp.*/ { printf "# MPD running on port: %s\n", $2 }'
51 docker port sima | awk -F: '$1 ~ /^6600\/tcp.*/ { printf "# MPD running on port: %s\nexport MPD_PORT=%s\n", $2, $2 }'
61 echo 'Already running container'
64 echo 'Running the current sima container'
68 test -z "${MUSIC}" && { echo "# Need a music directory to mount, please set MUSIC var:";
69 echo "MUSIC=~Music ./do start";
71 echo 'launching a new sima container'
72 local options="-p ${LISTEN}:${ICE_PORT}:8000"
73 options="${options} -p ${LISTEN}:${MPD_PORT}:6600"
74 options="${options} --volume ${MUSIC}:/music:ro"
75 docker run ${options} --detach=true --name sima kaliko/sima