Remove is_running from init.d script.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2019-08-14 22:59:25 +02:00
parent 1a741f696e
commit 0cc1e88608

View File

@@ -16,14 +16,9 @@ get_pid() {
pidof "pihole-FTL" pidof "pihole-FTL"
} }
is_running() {
ps "$(get_pid)" > /dev/null 2>&1
}
# Start the service # Start the service
start() { start() {
if is_running; then if get_pid > /dev/null 2>&1; then
echo "pihole-FTL is already running" echo "pihole-FTL is already running"
else else
# Touch files to ensure they exist (create if non-existing, preserve if existing) # Touch files to ensure they exist (create if non-existing, preserve if existing)
@@ -54,11 +49,11 @@ start() {
# Stop the service # Stop the service
stop() { stop() {
if is_running; then if get_pid > /dev/null 2>&1; then
/sbin/resolvconf -d lo.piholeFTL /sbin/resolvconf -d lo.piholeFTL
kill "$(get_pid)" kill "$(get_pid)"
for i in {1..5}; do for i in {1..5}; do
if ! is_running; then if ! get_pid > /dev/null 2>&1; then
break break
fi fi
@@ -67,7 +62,7 @@ stop() {
done done
echo echo
if is_running; then if get_pid > /dev/null 2>&1; then
echo "Not stopped; may still be shutting down or shutdown may have failed, killing now" echo "Not stopped; may still be shutting down or shutdown may have failed, killing now"
kill -9 "$(get_pid)" kill -9 "$(get_pid)"
exit 1 exit 1
@@ -82,7 +77,7 @@ stop() {
# Indicate the service status # Indicate the service status
status() { status() {
if is_running; then if get_pid > /dev/null 2>&1; then
echo "[ ok ] pihole-FTL is running" echo "[ ok ] pihole-FTL is running"
exit 0 exit 0
else else