Logging atd messages via syslog

From looking at the source of the 'at' program (from the CentOS 5.3 source repository) , it looks like it is indeed logging to syslog, but only fatal errors regarding the at daemon itself are logged (for example, if you try to run 2 at daemons at the same time).

However, process executions, resulting return code and standard error/output are not logged to syslog at all. Even when turning on debug (which requires recompilation) the log messages are not very informative (for end users) and write something like :

atd[24116]: pid 24121 exited with status 0.

Which will not help you a lot in identifying which command was ran, by which user or what was its standard output/error.

atd does send an email notification to the user who requested the command, in case the command had failed, or produced anything in it's standard output/error. But for commands that succeed without any output , no mail is sent. You can change that using the -m flag.

From at(1):

-m Send mail to the user when the job has completed even if there was no output.


For cases like this I'll use a wrapper around the command that logs to syslog. For example:

#!/bin/bash
logger -i -t mycmd Starting
/bin/somecommand
logger -i -t mycmd Completed
exit 0

Then from cron, at, etc I'll call the wrapper script instead.

I know this is more of a work around than a solution, but it gets the job done.


/var/log/secure(RHEL)

atd logs via PAM, check your syslog.conf to find out where pam is logging to.