summaryrefslogtreecommitdiff
path: root/shutdownasap
diff options
context:
space:
mode:
Diffstat (limited to 'shutdownasap')
-rwxr-xr-xshutdownasap23
1 files changed, 9 insertions, 14 deletions
diff --git a/shutdownasap b/shutdownasap
index e921b84..366b1f0 100755
--- a/shutdownasap
+++ b/shutdownasap
@@ -1,8 +1,10 @@
#!/bin/bash
-[ -e /tmp/shutdownasap.pid ] && ps aux | grep -q "^[^ ]* *$(cat /tmp/shutdownasap.pid) " && exit
+. /etc/shutdownasap.conf
-echo $$ > /tmp/shutdownasap.pid
+[ -r "${pidFile}" ] && ps aux | grep -q "^\S\+\s\+$(cat "${pidFile}") " && exit
+
+echo $$ > "${pidFile}"
i=1
while [ ${i} -gt 0 ]
@@ -12,11 +14,11 @@ do
nochwarten=false
- if ls -1A /home/shutdown/.warteauf | grep -q "."
+ if ls -1A "${waitForDir}" | grep -q "."
then
nochwarten=true
echo ".warteauf: "
- ls -1A /home/shutdown/.warteauf
+ ls -1A "${waitForDir}"
fi
if users | grep -q "."
@@ -36,10 +38,9 @@ do
fi
done
- for s in $(cat /etc/shutdownnogo)
+ for s in "${!shutDownNoGos[@]}"
do
- [ "${s}" == "backup" ] && t="${s}" || t="${s}\(\$\|\s\)"
- if echo "${prozesse}" | grep -q "\(\s\|/\)${t}\(\$\|\s\)"
+ if echo "${prozesse}" | grep -q "\(\s\|/\)${shutDownNoGos[${s}]}\(\$\|\s\)"
then
nochwarten=true
echo "prozess: ${s}"
@@ -57,12 +58,6 @@ do
i=$[${i}-1]
done
-if ping 192.168.0.15 -c1 &> /dev/null
-then
- if ssh shutdown@192.168.0.15 ls -1 /home/shutdown/.warteauf | grep -q "^192\.168\.0\.18\$"
- then
- ssh shutdown@192.168.0.15 rm /home/shutdown/.warteauf/192.168.0.18
- fi
-fi
+beforeShutDownHook
sudo /sbin/poweroff