summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xshutdownasap.in42
-rw-r--r--shutdownasap.service.in2
2 files changed, 33 insertions, 11 deletions
diff --git a/shutdownasap.in b/shutdownasap.in
index 6184367..328e7ba 100755
--- a/shutdownasap.in
+++ b/shutdownasap.in
@@ -10,6 +10,14 @@ set -e
echo $$ > "${pidFile}"
+quiet=false
+if [ $# -eq 1 ] && [ "x$1" = 'x-q' ]; then
+ quiet=true
+elif [ $# -ne 0 ]; then
+ >&2 echo 'usage: shutdownasap [-q]'
+ exit 1
+fi
+
beforeWatchHook
i=1
@@ -23,15 +31,19 @@ do
if [ -d "${waitForDir}" ] && ls -1A "${waitForDir}" | grep -q "."
then
nochwarten=true
- echo ".warteauf: "
- ls -1A "${waitForDir}"
+ if ! ${quiet}; then
+ echo ".warteauf: "
+ ls -1A "${waitForDir}"
+ fi
fi
if users | grep -q "."
then
nochwarten=true
- echo -n "users: "
- users
+ if ! ${quiet}; then
+ echo -n "users: "
+ users
+ fi
fi
for synActFile in /sys/block/md*/md/sync_action
@@ -39,8 +51,10 @@ do
if [ -r "${synActFile}" ] && ! grep -q "^idle\$" "${synActFile}"
then
nochWarten=true
- echo -n "raid ${synActFile}: "
- cat "${synActFile}"
+ if ! ${quiet}; then
+ echo -n "raid ${synActFile}: "
+ cat "${synActFile}"
+ fi
fi
done
@@ -49,7 +63,9 @@ do
if echo "${prozesse}" | grep -q "\(\s\|/\)${shutDownNoGoProcesses[${s}]}\(\$\|\s\)"
then
nochwarten=true
- echo "prozess: ${s}"
+ if ! ${quiet}; then
+ echo "prozess: ${s}"
+ fi
fi
done
@@ -58,17 +74,23 @@ do
if [ -e "${shutDownNoGoFiles[${s}]}" ] && echo "${prozesse}" | grep -q "^\S\+\s\+$(cat "${shutDownNoGoFiles[${s}]}")\s"
then
nochwarten=true
- echo "datei: ${s}"
+ if ! ${quiet}; then
+ echo "datei: ${s}"
+ fi
fi
done
if ${nochwarten}
then
- echo "warten ..."
+ if ! ${quiet}; then
+ echo "warten ..."
+ fi
i=10
continue
else
- echo "noch ${i} Sekunden"
+ if ! ${quiet}; then
+ echo "noch ${i} Sekunden"
+ fi
fi
i=$[${i}-1]
done
diff --git a/shutdownasap.service.in b/shutdownasap.service.in
index 0c3f6c8..9cae1af 100644
--- a/shutdownasap.service.in
+++ b/shutdownasap.service.in
@@ -2,4 +2,4 @@
Description=shut down asap
[Service]
-ExecStart=#BINDIR#/shutdownasap
+ExecStart=#BINDIR#/shutdownasap -q