diff options
author | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2023-02-18 09:08:45 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2023-02-18 09:13:42 +0700 |
commit | fb70acbb6420f3f1e57a23fa0768f0580f968f9c (patch) | |
tree | 5a183f5c328108586bf1f2ff2f7102d6385581f3 /system/webmin/stop.new | |
parent | a4cd3b4dce4ac81f7109262805402b5bdd737764 (diff) |
system/webmin: Fix script.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/webmin/stop.new')
-rw-r--r-- | system/webmin/stop.new | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/system/webmin/stop.new b/system/webmin/stop.new new file mode 100644 index 0000000000000..a540974bddec5 --- /dev/null +++ b/system/webmin/stop.new @@ -0,0 +1,21 @@ +#!/bin/sh +if [ "$1" = "--kill" ]; then + echo Force stopping Webmin server in /usr/libexec/webmin +else + echo Stopping Webmin server in /usr/libexec/webmin +fi +pidfile=`grep "^pidfile=" /etc/webmin/miniserv.conf | sed -e 's/pidfile=//g'` +pid=`cat $pidfile 2>/dev/null` +if [ "$pid" != "" ]; then + kill $pid || exit 1 + touch /var/log/webmin/stop-flag + if [ "$1" = "--kill" ]; then + sleep 1 + ((ps axf | grep "/usr/libexec/webmin\/miniserv\.pl" | awk '{print "kill -9 -- -" $1}' | bash) || kill -9 -- -$pid || kill -9 $pid) 2>/dev/null + fi + exit 0 +else + if [ "$1" = "--kill" ]; then + (ps axf | grep "/usr/libexec/webmin\/miniserv\.pl" | awk '{print "kill -9 -- -" $1}' | bash) 2>/dev/null + fi +fi |