Operating System - HP-UX
1849807 Members
1848 Online
104044 Solutions
New Discussion

atjobs and cron log - detailed version available

 
SOLVED
Go to solution
David Bonham_1
Advisor

atjobs and cron log - detailed version available

Forgive me if this has been asked before;

I have an application that submits 'at' jobs on behalf of the user and usually runs those jobs immediately. I can see the job submitted in /var/adm/cron/log, but all I see is the 'at' job number. Since the jobs run immediately using at -l and at -d won't help me in this case.

Apart from altering the application to capture and log the stdout from the 'at' command, are there any other options to see exactly what was run? Possibly more detailed logging for the cron daemon?

TIA

5 REPLIES 5
Michael Tully
Honored Contributor

Re: atjobs and cron log - detailed version available

Unfortunately, with at/cron what you see is what you get ... not a lot. You'd be better served building in some proper logging into your program/scripts from the application to capture what your after.
Anyone for a Mutiny ?
Sundar_7
Honored Contributor
Solution

Re: atjobs and cron log - detailed version available

I dont know if this would sound like a good idea to you. but how about renaming at and create a kind of wrapper for at.

Whenever the application use "at" , your script will be called, in turn you can log whatever u want, whereever u want and call at in ur script.

Learn What to do ,How to do and more importantly When to do ?
David Bonham_1
Advisor

Re: atjobs and cron log - detailed version available

Thanks to both of you.

Sundar, that's a very good suggestion. I can't believe I didn't think of that because I used the same fix to solve a problem I was having with the cancel/mail command.

I'm not sure if I'll go the route of the shell script 'wrapper' for at, but at least I have an option.

Thanks again.

Bill Hassell
Honored Contributor

Re: atjobs and cron log - detailed version available

Actually, it's quite easy to see exactly what is run in cron and at. Just change the command to insert sh -x in front of the script:

10 1 * * * /sbin/sh -x /wherever/myscript

The script will be traced every time it is run. If this is too much logging, just add an echo or two inside the script and redirect it to stderr.


Bill Hassell, sysadmin
David Bonham_1
Advisor

Re: atjobs and cron log - detailed version available

I just found a way to alter the submitted 'at' job! See 'man proto' for more info.

if I edit the /var/adm/cron/.proto (prototype file) and insert a set -x just before the submitted script ($<) then the out put will get mailed to the user, which in my case I have forwared to me.

I think one could get pretty creative with the .proto file, but at least I've got more options now.