3 # Positive tests for cron, that means these tests have to pass
10 if [ "$tvar" = "redhat" -o "$tvar" = "redhat-linux" ]
12 CRON_ALLOW
="/etc/cron.allow"
14 CRON_ALLOW
="/var/spool/cron/allow"
18 if [ $iam = "root" ]; then
19 if [ $# -lt 1 ] ; then
20 echo Either
do not run this
script as root or start it like
25 mv $CRON_ALLOW $CRON_ALLOW.old
&> /dev
/null
28 mv $CRON_ALLOW.old
$CRON_ALLOW &> /dev
/null
32 function restorecrontab
() {
33 test -e /tmp
/crontab-save-
$iam && \
34 crontab
/tmp
/crontab-save-
$iam && \
35 rm -f /tmp
/crontab-save-
$iam && \
36 echo restored old crontab
39 echo Running as user
$iam...
41 # Save current users crontab
43 test -e /tmp
/crontab-save-
$iam && rm -f /tmp
/crontab-save-
$iam
45 if [ "0" -lt `crontab -l 2>/dev/null | wc -l` ]; then
47 echo 'crontab of this user exists -> creating backup'
48 crontab
-l |
grep '^[^#]' > /tmp
/crontab-save-
$iam
56 rm -rf /tmp
/crontest
&> /dev
/null
57 mkdir
-p /tmp
/crontest
59 cat > /tmp
/crontest
/testjob_cron01
<< EOF
64 chmod 755 /tmp
/crontest
/testjob_cron01
67 `date '+%M' | awk '{ print ($1+2)%60 " * * * * "
68 }'` /tmp/crontest/testjob_cron01 >> /tmp/crontest/output_cron01 2>&1
73 if [ $rc = "1" ]; then
74 echo Error
while adding crontab
for user
$iam
79 echo new job added successfully
81 # 2. Wait for execution of job
83 echo 'sleeping for 130 seconds...'
87 test -e /tmp
/crontest
/output_cron01
&& rc
=0
89 if [ $rc = "1" ]; then
90 echo Job has not been executed
95 grep "Testjob running" /tmp
/crontest
/output_cron01
97 if [ $rc = "1" ]; then
98 echo Job has not produced valid output
102 echo 'job has been executed :-)'
103 echo "testjob's output:"
114 # Restore old crontab file