Date: Saturday, February 5, 2011 @ 15:09:03 Author: andrea Revision: 109082
upgpkg: icecast 2.3.2-5 rewritten init script (FS#22776) Modified: icecast/trunk/PKGBUILD icecast/trunk/icecastd ----------+ PKGBUILD | 8 +++--- icecastd | 73 ++++++++++++++++++++++++++++++------------------------------- 2 files changed, 40 insertions(+), 41 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2011-02-05 18:15:24 UTC (rev 109081) +++ PKGBUILD 2011-02-05 20:09:03 UTC (rev 109082) @@ -1,12 +1,12 @@ # $Id$ -# Maintainer: Andrea Scarpino <[email protected]> +# Maintainer: +# Contributor: Andrea Scarpino <[email protected]> # Contributor: Andreas Radke <[email protected]> # Contributor: Jason Chu <[email protected]> -# Contributor: dorphell <[email protected]> pkgname=icecast pkgver=2.3.2 -pkgrel=4 +pkgrel=5 pkgdesc="Streaming audio over the Internet" arch=('i686' 'x86_64') license=('GPL') @@ -18,7 +18,7 @@ 'icecastd' 'icecast.logrotate' 'start-by-nobody.patch') md5sums=('ff516b3ccd2bcc31e68f460cd316093f' - '464ef7e110d32998f60e5bea293acc92' + 'e823c1fdb080aae3d0c54ef8be95f7cb' '59c6552bcb1dd9fb542af8670dfabd3c' 'd8e929d2214123a1954da4383bf16583') Modified: icecastd =================================================================== --- icecastd 2011-02-05 18:15:24 UTC (rev 109081) +++ icecastd 2011-02-05 20:09:03 UTC (rev 109082) @@ -3,58 +3,57 @@ . /etc/rc.conf . /etc/rc.d/functions +timeo=30 + getPID() { - echo $(pgrep -u nobody icecast 2>/dev/null); + pgrep -u nobody icecast 2>/dev/null } -case "$1" in +case $1 in start) stat_busy "Starting Icecast Server" - if [ -z "$(getPID)" ]; then + if getPID >/dev/null; then + # already running + stat_fail + exit 1 + else /usr/bin/icecast -b -c /etc/icecast.xml &>/dev/null - timeo=30 - while [ $timeo -gt 0 ]; do - [ ! -z "$(getPID)" ] && break + while (( timeo > 0 )); do + if getPID >/dev/null; then + add_daemon icecast + stat_done + exit 0 + fi sleep 1 - let timeo=${timeo}-1 + (( timeo-- )) done - if [ $timeo -eq 0 ]; then - stat_fail - exit 1 - else - add_daemon icecast - stat_done - fi - else - stat_fail - exit 1 + stat_fail + exit 1 fi ;; stop) stat_busy "Stopping Icecast Server" - if [ ! -z "$(getPID)" ]; then - timeo=30 - kill $(getPID) &> /dev/null - if [ $? -gt 0 ]; then - stat_fail - exit 1 - fi - while [ ! -z "$(getPID)" -a $timeo -gt 0 ]; do - sleep 1 - let timeo=${timeo}-1 - done - if [ -z "$(getPID)" ]; then - rm_daemon icecast - stat_done - else - stat_fail - exit 1 - fi - else + if ! getPID >/dev/null; then + # not running stat_done exit 1 fi + if ! kill $(getPID) &> /dev/null; then + stat_fail + exit 1 + fi + while (( timeo > 0 )); do + if getPID >/dev/null; then + rm_daemon icecast + stat_done + exit 0 + fi + sleep 1 + (( timeo-- )) + done + stat_fail + exit 1 ;; restart) @@ -62,6 +61,6 @@ $0 start ;; *) - echo "usage: $0 {start|stop|restart}" + echo "usage: $0 {start|stop|restart}" esac exit 0
