From e494cc325d510edfc1e21b7ca084ef561dcaa22d Mon Sep 17 00:00:00 2001
From: "cam.lafit" <cam.lafit@azerttyu.net>
Date: Thu, 10 Aug 2023 11:43:09 +0200
Subject: [PATCH] Display crontab status

Inform about crontab content without display itself
---
 clean_spip.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/clean_spip.sh b/clean_spip.sh
index b958211..e29d019 100644
--- a/clean_spip.sh
+++ b/clean_spip.sh
@@ -322,14 +322,19 @@ function clean_spip() {
 function check_crontab() {
   local spip_dir
   local user
+  local crontab_content
 
   spip_dir=$1
   user=$(stat --printf %U "${spip_dir}")
 
   # Process only once each crontab
   if [[ $(echo "${global_crontab_users[@]}" | grep -ow "${user}" | wc -w) -lt 1 ]]; then
-     global_crontab_users+=("${user}")
-     crontab -lu "${user}"
+    global_crontab_users+=("${user}")
+    if crontab_content=$(crontab -lu "${user}") ; then
+      vprint "$user has a crontab to check" "RED"
+    else
+      vprint "$crontab_content" "WHITE"
+    fi
   fi
 }
 
-- 
GitLab