From 13fe79fd25553cb2da23de556fc7200bea8248a5 Mon Sep 17 00:00:00 2001
From: Thomas Boettcher <boettcher@rz.rwth-aachen.de>
Date: Mon, 14 Apr 2025 13:05:16 +0200
Subject: [PATCH] skipping header as option

---
 usr/local/sbin/check-certs | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/usr/local/sbin/check-certs b/usr/local/sbin/check-certs
index ea80b24..d39dc66 100755
--- a/usr/local/sbin/check-certs
+++ b/usr/local/sbin/check-certs
@@ -5,12 +5,13 @@ WarnDays=60
 CritDays=30
 workdir=/usr/local/cert
 searchfile=cert.pem
+header=true
 ec=0
 tmpfile=$( mktemp )
 
 function usage {
         echo >&2
-        echo "$0 [-w <days>] [-c <days>] [-d <dir>] [-f <filename>]" >&2
+        echo "$0 [-w <days>] [-c <days>] [-d <dir>] [-f <filename>] [-n]" >&2
         echo >&2
         echo "checks if enddate of certificates in location are critical." >&2
         echo >&2
@@ -23,6 +24,7 @@ function usage {
         echo "                  DEFAULT:$workdir" >&2
         echo "  -f <filename>   filename to find" >&2
         echo "                  DEFAULT:$searchfile" >&2
+        echo "  -n              no header output"
         echo >&2
         exit 3
 }
@@ -43,6 +45,9 @@ do
                 f)
                         searchfile=$OPTARG
                         ;;
+		n)
+			header=false
+			;;
                 \?)
                         usage
                         ;;
@@ -50,7 +55,7 @@ do
 done
 
 # TABLE HEADER OUTPUT
-echo -e "enddate\t\tdays\tstatus\tfile"
+[ "$header" = "true" ] && echo -e "enddate\t\tdays\tstatus\tfile"
 
 # WORKING CHECKS
 (
-- 
GitLab