mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-25 06:10:20 +00:00
Improve FTL's service script
This commit is contained in:
parent
1d64b614c7
commit
3eacfa9831
1 changed files with 6 additions and 8 deletions
|
@ -17,7 +17,7 @@ get_pid() {
|
||||||
}
|
}
|
||||||
|
|
||||||
is_running() {
|
is_running() {
|
||||||
[ -f "$PIDFILE" ] && ps $(get_pid) > /dev/null 2>&1
|
[ -f "$PIDFILE" ] && ps "$(get_pid)" > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Start the service
|
# Start the service
|
||||||
|
@ -36,8 +36,8 @@ start() {
|
||||||
# Stop the service
|
# Stop the service
|
||||||
stop() {
|
stop() {
|
||||||
if is_running; then
|
if is_running; then
|
||||||
kill $(get_pid)
|
kill "$(get_pid)"
|
||||||
for i in {1..10}; do
|
for i in {1..5}; do
|
||||||
if ! is_running; then
|
if ! is_running; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
@ -48,7 +48,8 @@ stop() {
|
||||||
echo
|
echo
|
||||||
|
|
||||||
if is_running; then
|
if is_running; then
|
||||||
echo "Not stopped; may still be shutting down or shutdown may have failed"
|
echo "Not stopped; may still be shutting down or shutdown may have failed, killing now"
|
||||||
|
kill -9 "$(get_pid)"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "Stopped"
|
echo "Stopped"
|
||||||
|
@ -61,16 +62,13 @@ stop() {
|
||||||
|
|
||||||
### main logic ###
|
### main logic ###
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
|
||||||
start
|
|
||||||
;;
|
|
||||||
stop)
|
stop)
|
||||||
stop
|
stop
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
status pihole-FTL
|
status pihole-FTL
|
||||||
;;
|
;;
|
||||||
restart|reload|condrestart)
|
start|restart|reload|condrestart)
|
||||||
stop
|
stop
|
||||||
start
|
start
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue