diff --git a/multimedia/sickchill/rc.sickchill b/multimedia/sickchill/rc.sickchill index 28fa0050d0..f36eb79604 100644 --- a/multimedia/sickchill/rc.sickchill +++ b/multimedia/sickchill/rc.sickchill @@ -97,6 +97,7 @@ status() start() { if [ $STATUS == "stopped" ]; then + echo -n "Starting $PROG: " if su "$USERNAME" -s /bin/sh -c "/usr/bin/${PROG} --daemon --pidfile=${PIDFILE} --datadir=${DATADIR} --port=${PORT} &> /dev/null"; then echo "Startup Successful" else @@ -121,11 +122,12 @@ stop() echo "Please run as root" exit 1 fi - echo -n $"Shutting down $PROG: " - curl -s http://localhost:"$PORT"/home/shutdown/?pid="$(cat "$PIDFILE")" | grep -q "shutting down" # sickchill can take some time to properly shut down. - #Give it 10 seconds before forcing it to close. - TIMEOUT=10 + # It takes more than 10 seconds on my system top properly close. + # If it doesn't close by the timeout, force close it. + TIMEOUT=15 + echo -n $"Giving $PROG $TIMEOUT seconds to shut down: " + curl -s http://localhost:"$PORT"/home/shutdown/?pid="$(cat "$PIDFILE")" | grep -q "shutting down" for (( COUNT=0; COUNT <= TIMEOUT; COUNT++ )); do if pgrep -f "$FULLPROG.*$PORT" > /dev/null; then SHUTDOWN=success @@ -155,6 +157,8 @@ case "$1" in restart) check stop + sleep 1 + check start ;; status)