System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a log for commands ran via 'at now'

 
Highlighted
Frequent Advisor

Is there a log for commands ran via 'at now'

HPUX v3

Is there a log similar to /var/adm/cron/log for commands ran by 'at now'?

For example, is there a way to find the
command line listed below after the command runs?

at now {return}
/home/my_shell_script.sh yes 4711 {return}
{CTRL D}

Thanks,
Ray
10 REPLIES 10
Highlighted
Honored Contributor

Re: Is there a log for commands ran via 'at now'

Hi,

#at -l

You will see output such as:
job 8745156.a at wed Sep 17 11:00:00 2010

Rgds
Highlighted
Honored Contributor

Re: Is there a log for commands ran via 'at now'

Ooooops, previous post is just for tasks pending to run! Foget it!
Highlighted
Honored Contributor

Re: Is there a log for commands ran via 'at now'

In HP-UX, the cron daemon runs both cron and at jobs. So the command line should be visible in /var/adm/cron/log.

MK
MK
Highlighted
Frequent Advisor

Re: Is there a log for commands ran via 'at now'

I did a test and all that gets into the /var/adm/cron/log is the job identifier in the form jobnumber.queue, CMD: 1296664522.a in this case. Which is not very helpful. Any other thoughts?

For example:

# at now +2 minute
ls -lt > ./somefile.txt
warning: commands will be executed using /usr/bin/sh
job 1296664522.a at Wed Feb 2 17:35:22 2011


tail /var/adm/cron/log
< root 9766 c Wed Feb 2 17:35:00 MET 2011
> CMD: 1296664522.a
> root 9785 a Wed Feb 2 17:35:22 MET 2011
< root 9785 a Wed Feb 2 17:35:22 MET 2011
Highlighted
Outstanding Contributor

Re: Is there a log for commands ran via 'at now'

I would think you should have the command you're running do it's own logging. Then you can verify that it ran by looking at cronlog if need be, but you'll have the detail you need in your own log file. The system isn't going to do this automatically for you.


Pete

Pete
Highlighted
Honored Contributor

Re: Is there a log for commands ran via 'at now'

As you see, at jobs are simply scripts run by cron. That's all that is going to show up in the cron log. It's no different than a script you schedule in cron being identified in the log. You don't know what the exact commands within the scripts are for those either.
--
Jeff Traigle
Highlighted
Frequent Advisor

Re: Is there a log for commands ran via 'at now'

Hi Jeff, I disagree with the last statement about how 'at' jobs and 'cron' jobs show in the log.

cron entries show the entire command line:
> CMD: /opt/sfm/bin/restart_sfm.sh
> root 12573 c Wed Feb 2 04:05:00 MET 2011
< root 12573 c Wed Feb 2 04:05:03 MET 2011

'at now' shows only the the job identifier:
> CMD: 1296664522.a
> root 9785 a Wed Feb 2 17:35:22 MET 2011
< root 9785 a Wed Feb 2 17:35:22 MET 2011

Makes me wonder if there is a configuration missing somewhere.
Highlighted
Outstanding Contributor

Re: Is there a log for commands ran via 'at now'

Spending a little time with the man pages for at might prove fruitful - particularly the "How Jobs Are Processed" section:

. . .
An at or batch job consists of a two-part script stored in /var/spool/cron/atjobs that can be executed by the POSIX shell. The first part sets up the environment to match the environment when the at or batch command was issued. The second part consists of the commands that you entered.
. . .

That's how at works and that's why all you see is the job-id. As I said before, I'm not sure what else you wish to see, but if you alter the command that you are at'ing to do it's own logging then you can log anything you wish.


Pete

Pete
Highlighted
Acclaimed Contributor

Re: Is there a log for commands ran via 'at now'

>Any other thoughts?

Always use crontab vs at(1)?
at(1) does have a benefit of saving your environment but not your aliases.