#!/bin/bash
#
# test_crontabs
#
# Crontabs aller User ans ULS
##############################
#
if [[ $# -lt 2 ]]
 then
  set `date '+%F %T%:z'`
fi
#
DT="$1 $2"
TZ="$3"
#
for user in `sort -t: -u -n -k 3,3 /etc/passwd | awk -F: '{print $1}'`
 do
  if crontab -u $user -l >/dev/null 2>/dev/null
   then
    send_test_value System "Crontab:$user" Crontab $DT "`crontab -u $user -l`" "_"
 fi
done
#
# Alle Dateien in den Verzeichnissen /etc/cron.*
#
CRONDIRS="cron.d cron.daily cron.hourly cron.monthly cron.weekly"
#
for c in $CRONDIRS
 do
  if cd /etc/$c
   then
    ls | while read f
     do
      send_stdin2uls System "Crondir:$c" "$f" $DT '_' <"/etc/$c/$f"
    done
  fi
done
