I have been reading the handbook on cronjobs lately in an attempt to learn more about FreeBSD and how to get the most out of it.
So, I recently wrote a small cronjob and implemented it. It runs daily along with the daily system cronjobs which are essentially built-into FreeBSD ver 14.4.
Here is my cronjob as I have written it:
(I am suspicious that I should have [(space) , and (space) ] before and after both the
I am getting this message in root's mailbox every day.
So, what does this "root: not found" mean?
Ken Gordon
So, I recently wrote a small cronjob and implemented it. It runs daily along with the daily system cronjobs which are essentially built-into FreeBSD ver 14.4.
Here is my cronjob as I have written it:
Code:
#/bin/sh
# Automated Lynis Scan Script
#Define log and report paths
LOGFILE="/var/log/lynis-cron.log"
REPORTFILE="/var/log/lynis-report.dat"
/usr/local/bin/lynis "audit system --/usr/local/bin/lynis_cron.sh" --quick > $LOGFILE 2>&1
# Optional: Send an email alert if warnings are found in log
if grep -q "Warning:" $LOGFILE; then mail -s "Lynis Security Warning on $KensOffice" root < LOGFILE
fi
(I am suspicious that I should have [(space) , and (space) ] before and after both the
if/then statement.) Like this:
Code:
if [ grep -q "Warning:" $LOGFILE; ]
then [ mail -s "Lynis Security Warning on $KensOffice" root < LOGFILE ]
I am getting this message in root's mailbox every day.
Code:
Message 3:
From root@KensOffice Tue Jul 7 03:00:00 2026
From: Cron Daemon <root@KensOffice>
To: root
Subject: Cron <root@KensOffice> root /usr/local/bin/lynis_cron.sh
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>
Date: Tue, 07 Jul 2026 03:00:00 -0700
/bin/sh: root: not found
So, what does this "root: not found" mean?
Ken Gordon