Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capture AT job name

Status
Not open for further replies.

jbonin

Programmer
Mar 25, 2002
11
US
I would like to capture the job name given by the AT command
for later use to "at -r" the job. It is assumed that this job will be submitted to run at a later time and someone
may need to kill it, but obviously the name of the shell
script doesn't become the actual job name in "at -l" output.

Any way to do this?

Thanks,
John
 
Here's a starting point, but you will have to do some
more coding to extract the info that you want.

Robert

#!/usr/bin/ksh
at -l|while read LINE
do
AT_ID=`echo $LINE|awk '{print $4}'`
at -d $AT_ID
done
Robert G. Jordan

Robert@JORDAN2000.com
Unix Sys Admin
Chicago, Illinois U.S.A.
[lightsaber]
 
That script doesn't work on AIX due to the -d argument.

Also, I should have mentioned that there may be many jobs
in the AT queue, but I only want to kill one of the jobs
I submitted, not all of them, which is what your script
appears to do.

That is also why I want to be able to capture the job
name assigned by AT, because by just looking at all the
meaningless job id's assigned by AT, you really can't tell
which job is which based on the user.nnnnnnnnn.a, and since
the at -l listing doesn't even give the name of the job
you want it to run, it makes it difficult to point to
one of the jobs out of many to issue the "at -r" against.

At least if I could capture the output given by AT when you
send a command to AT, I could somehow parse that and store it in a "queue" file along with the shell name being run.
Then all I have to do is query that file, present a list
with the shell name they can identify with, and behind the
scenes issue the at -r with the meaningless AT job name.

John
 
Check this directory
if you have the privileges to do so.

/usr/spool/cron/atjobs

Try doing a cat on the jobs names
and you should see the commands they are running.

Robert Robert G. Jordan

Robert@JORDAN2000.com
Unix Sys Admin
Chicago, Illinois U.S.A.
[lightsaber]
 
Thanks Robert, again you have a good suggestion and again
I strike out. Must be opening day! :)

I have no privileges on the machine other
than to kill my own jobs, or possibly to su to another
user and kill their jobs in this quest.

Thanks,
John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top