Files
webgui/plugins/dynamix/scripts/rc.diskload
2017-03-24 22:55:19 +01:00

31 lines
565 B
Bash
Executable File

#!/bin/sh
script="diskload"
daemon="/usr/local/emhttp/webGui/scripts/$script"
case $1 in
start)
if [[ -z $(pgrep -f $daemon) ]]; then
$daemon 1>/dev/null 2>&1
echo "$script started"
else
echo "$script already running!"
fi
;;
stop)
if [[ -n $(pgrep -f $daemon) ]]; then
pkill -f $daemon 1>/dev/null 2>&1
timer=5
until [[ -z $(pgrep -f $daemon) || $timer -eq 0 ]]; do
((timer--))
sleep 1
done
echo "$script stopped"
else
echo "$script not running!"
fi
;;
*)
echo "Usage: $(basename $0) start|stop"
esac