summaryrefslogtreecommitdiff
path: root/shutdownasap
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-04-10 11:21:56 +0200
committerErich Eckner <git@eckner.net>2016-04-10 11:21:56 +0200
commitee45f2e79c67d17ba4c0a67617d6a08f85af085e (patch)
tree225f2372da27fbfac6a287a95e22ff7cef5fd046 /shutdownasap
parent4eb26ade00c26cee4a112fa8e4113b1699357d99 (diff)
downloadshutdownasap-ee45f2e79c67d17ba4c0a67617d6a08f85af085e.tar.xz
skripte soweit erstmal fertigv0.0
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