mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-16 19:50:19 +01:00
multimedia/sickchill: Tweak shutdown/startup/restart for rc file
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
parent
07ea90f807
commit
509e12cf32
1 changed files with 8 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue