diff options
author | Erich Eckner <git@eckner.net> | 2019-04-09 14:09:52 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-04-09 14:09:52 +0200 |
commit | 2675f60d07d5a4b2f3e35d9da4450bf82b8b8909 (patch) | |
tree | 79ba5d9ab5f67782c840690909871bd579ed31e4 /shutdownasap.in | |
parent | 685877f6e1d33db498c27f73300812eb361161bc (diff) | |
download | shutdownasap-2675f60d07d5a4b2f3e35d9da4450bf82b8b8909.tar.xz |
service should run silently
Diffstat (limited to 'shutdownasap.in')
-rwxr-xr-x | shutdownasap.in | 42 |
1 files changed, 32 insertions, 10 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 |