Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Apr 2002 16:03:50 -0600
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Rick.Robinson@bankofamerica.com
Cc:        questions@FreeBSD.ORG
Subject:   Re: AT Logging Question
Message-ID:  <20020405220350.GO75339@dan.emsphone.com>
In-Reply-To: <86256B92.00752289.00@notes.bankofamerica.com>
References:  <86256B92.00752289.00@notes.bankofamerica.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Apr 05), Rick.Robinson@bankofamerica.com said:
> Is there any logging kept from jobs that are run from at or batch?

It doesn't look like it.  Completed jobs do hang around in /var/at/jobs
for 5 minutes (the next atrun cleans them), though, so the poor mans's
solution would be to change the atrun line in /etc/crontab to read

*/5 * * * * root /usr/libexec/atrun ; atq -v | grep '(done)' | logger -p cron.notice -t atrun

, which would log the fact that a job was run, but no more infomartion
than that:

Apr  5 15:59:18 <9.5> dan atrun: Fri Apr  5 15:56:00 CST 2002   root c(done) 9

Doing real cron-style logging is not that simple, because the input to
at/batch could be a large script, so what would you log?  If you just
want to log (say) the first 80 chars of the command, it would be pretty
easy to add to atrun, so /var/log/cron would look like:

Apr  5 15:35:00 <9.6> dan /usr/sbin/cron[93683]: (root) CMD (/usr/libexec/atrun)
Apr  5 15:35:00 <9.6> dan /usr/libexec/atrun[93684]: (user1) CMD (echo hi)
Apr  5 15:35:00 <9.6> dan /usr/libexec/atrun[93685]: (user2) CMD (echo test job)

-- 
	Dan Nelson
	dnelson@allantgroup.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020405220350.GO75339>