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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Identify and kill job running from AT 1

Status
Not open for further replies.

jbonin

Programmer
Mar 25, 2002
11
0
0
US
I have an interesting problem I hope some of you UNIX
wizards might be able to shed some light on and make some suggestions, or even possibly some "close" code I could
work from to make this work.

I need to be able to kill a process that was submitted to
the AT command, but is now running as a process. The job
will be running and killed from the account that submitted
the job originally to AT, but it is the identity of the PID
that seems to be problem. It looks like several PID's get
created for the one job that was kicked off, and the
command shell name is usually not part of the job when
showing the output from "ps -ef".

Any good ideas?

Thanks,
John
 
guess you need to take note of the ID number
that at assigns when you the job is initially scheduled.

# at 6 am Friday
echo "hello!"
warning: commands will be executed using /usr/bin/sh
job 1018008000.a at Fri Apr 5 06:00:00 2002
# at -l
user = root 1018008000.a Fri Apr 5 06:00:00 2002
# at -r 1018008000.a

-----
in a script you may be able to do something like this...
run your at command, then
AT_ID=`at -l|tail -1|awk '{print $4}'
at -r $AT_ID

Robert Robert G. Jordan

Robert@JORDAN2000.com
Unix Sys Admin
Chicago, Illinois U.S.A.
[lightsaber]
 
Thanks Robert, but once the job is "running", it is no longer available for output from "at -l", right? This may be a runaway job that was submitted to run immediately from the AT command.

John
 
I guess I should have mentioned this is AIX and I don't
see a -d argument for the AT command.

at -d
Usage: at [-c|-k|-s|-q {a|b|e|f}] [-m] [-f File] Time [Day] [Increment]
Usage: at [-c|-k|-s|-q {a|b|e|f}] [-m] [-f File] -t [[CC]YY]MMDDhhmm[.SS]
Usage: at -l [-o] [ JobNumber... | -q {a|b|e|f} ]
Usage: at -r [-Fi] JobNumber ... [-u User]
Usage: at -n [User]

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top