blob: 6184367bba9c4108ba7926cf393a6fdaeb490e83 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#!/bin/bash
# shutdownasap version #VERSION#
set -e
. #ETCDIR#/shutdownasap.conf
[ -r "${pidFile}" ] && ps aux | grep -q "^\S\+\s\+$(cat "${pidFile}") " && exit
echo $$ > "${pidFile}"
beforeWatchHook
i=1
while [ ${i} -gt 0 ]
do
sleep 1
prozesse="$(ps aux | grep -v grep)"
nochwarten=false
if [ -d "${waitForDir}" ] && ls -1A "${waitForDir}" | grep -q "."
then
nochwarten=true
echo ".warteauf: "
ls -1A "${waitForDir}"
fi
if users | grep -q "."
then
nochwarten=true
echo -n "users: "
users
fi
for synActFile in /sys/block/md*/md/sync_action
do
if [ -r "${synActFile}" ] && ! grep -q "^idle\$" "${synActFile}"
then
nochWarten=true
echo -n "raid ${synActFile}: "
cat "${synActFile}"
fi
done
for s in "${!shutDownNoGoProcesses[@]}"
do
if echo "${prozesse}" | grep -q "\(\s\|/\)${shutDownNoGoProcesses[${s}]}\(\$\|\s\)"
then
nochwarten=true
echo "prozess: ${s}"
fi
done
for s in "${!shutDownNoGoFiles[@]}"
do
if [ -e "${shutDownNoGoFiles[${s}]}" ] && echo "${prozesse}" | grep -q "^\S\+\s\+$(cat "${shutDownNoGoFiles[${s}]}")\s"
then
nochwarten=true
echo "datei: ${s}"
fi
done
if ${nochwarten}
then
echo "warten ..."
i=10
continue
else
echo "noch ${i} Sekunden"
fi
i=$[${i}-1]
done
beforeShutDownHook
sudo /sbin/poweroff
|