Whamcloud - gitweb
e2scrub: stop cron spam if lvm2 is not installed.
authorTheodore Ts'o <tytso@mit.edu>
Thu, 16 May 2019 18:56:37 +0000 (14:56 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 19 May 2019 01:43:57 +0000 (21:43 -0400)
Addresses-Debian-Bug: #928977

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
scrub/e2scrub_all.cron.in
scrub/e2scrub_all.in
scrub/e2scrub_all.service.in
scrub/e2scrub_all_cron.in
scrub/e2scrub_reap.service.in

index 7d42c3f..5bf83ec 100644 (file)
@@ -1,2 +1,2 @@
 30 3 * * 0 root test -e /run/systemd/system || @pkglibdir@/e2scrub_all_cron
-10 3 * * * root test -e /run/systemd/system || @root_sbindir@/e2scrub_all -A -r
+10 3 * * * root test -e /run/systemd/system || @root_sbindir@/e2scrub_all -C -A -r
index 31ebc79..7ee6531 100644 (file)
@@ -26,6 +26,7 @@ if (( $EUID != 0 )); then
 fi
 
 scrub_all=0
+run_from_cron=0
 snap_size_mb=256
 reap=0
 conffile="@root_sysconfdir@/e2scrub.conf"
@@ -73,6 +74,7 @@ while getopts "nrAV" opt; do
        "n") DBG="echo Would execute: " ;;
        "r") scrub_args="${scrub_args} -r"; reap=1;;
        "A") scrub_all=1;;
+       "C") run_from_cron=1;;
        "V") print_version; exitcode 0;;
        *) print_help; exitcode 2;;
        esac
@@ -84,13 +86,19 @@ shift "$((OPTIND - 1))"
 # when e2scrub_all is run out of cron or a systemd timer.
 
 if ! type lsblk >& /dev/null ; then
+    if [ "${run_from_cron}" -eq 1 ] ; then
+       exitcode 0
+    fi
     echo "e2scrub_all: can't find lsblk --- is util-linux installed?"
-    exitcode 0
+    exitcode 1
 fi
 
 if ! type lvcreate >& /dev/null ; then
+    if [ "${run_from_cron}" -eq 1 ] ; then
+       exitcode 0
+    fi
     echo "e2scrub_all: can't find lvcreate --- is lvm2 installed?"
-    exitcode 0
+    exitcode 1
 fi
 
 # Find scrub targets, make sure we only do this once.
index 20f42bf..77b6ad5 100644 (file)
@@ -8,5 +8,5 @@ Documentation=man:e2scrub_all(8)
 [Service]
 Type=oneshot
 Environment=SERVICE_MODE=1
-ExecStart=@root_sbindir@/e2scrub_all
+ExecStart=@root_sbindir@/e2scrub_all -C
 SyslogIdentifier=e2scrub_all
index f9cff87..bc26fee 100644 (file)
@@ -65,4 +65,4 @@ on_ac_power() {
 test -e /run/systemd/system && exit 0
 on_ac_power || exit 0
 
-exec @root_sbindir@/e2scrub_all
+exec @root_sbindir@/e2scrub_all -C
index cf26437..40511f7 100644 (file)
@@ -16,7 +16,7 @@ NoNewPrivileges=yes
 User=root
 IOSchedulingClass=idle
 CPUSchedulingPolicy=idle
-ExecStart=@root_sbindir@/e2scrub_all -A -r
+ExecStart=@root_sbindir@/e2scrub_all -C -A -r
 SyslogIdentifier=%N
 RemainAfterExit=no