From d28047b9dfdbb249dd5dbd350ca028364f449e60 Mon Sep 17 00:00:00 2001 From: Tristan Ancelet Date: Tue, 9 May 2023 21:41:55 -0500 Subject: [PATCH] Created convienence bash script to count the crontabs that exist on disk. --- count-crontabs.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 count-crontabs.sh diff --git a/count-crontabs.sh b/count-crontabs.sh new file mode 100755 index 0000000..9ea45d8 --- /dev/null +++ b/count-crontabs.sh @@ -0,0 +1,19 @@ +total_count=0 +declare -a crontab_dirs=( + /etc/cron.d + /etc/cron.daily + /etc/cron.hourly + /etc/cron.weekly + /var/spool/cron +) + +for dir in ${crontab_dirs[@]}; do + count=0; + for file in $dir/*; do + count=` ls -1 $dir | wc -l ` + done + echo "- $dir: $count
" + total_count=$(( $count + $total_count )) +done + +echo "Total: $total_count" \ No newline at end of file