System Administration

at -f (script) now how to kill?

 
debjit-India
Frequent Advisor

at -f (script) now how to kill?

I started a job with the below command
at -f /usr/script.sh now
script.sh contains lot of jobs and takes 30-40 hours to complete. In between I need to kill the job started by at for some emergency reason.

As "at" with now option doesnot create any job id in /var/spool/atjobs, how i can kill this job?
13 REPLIES 13
Hakki Aydin Ucar
Honored Contributor

Re: at -f (script) now how to kill?

you can simply kill -9
Kapil Jha
Honored Contributor

Re: at -f (script) now how to kill?

check what are the commands are there in script.

run ps -ef|grep command

Check, confirm and kill -9

do not worry about any at thing, it has done its work and went to sleep.

BR,
Kapil+
I am in this small bowl, I wane see the real world......
debjit-India
Frequent Advisor

Re: at -f (script) now how to kill?

Hi,
I cannot able to find the process id.
Ricky_HK
Frequent Advisor

Re: at -f (script) now how to kill?

ps -ef|grep script.sh

anything output?
Anshumali
Esteemed Contributor

Re: at -f (script) now how to kill?

You wrote, "script.sh contains lot of jobs and takes 30-40 hours to complete"

There must be a proces which runs for 30-40 hours!! grep for that. If its not there, it may have already gone past.
Dreams are not which you see while sleeping, Dreams are which doesnt allow you to sleep while you are chasing for them!!
debjit-India
Frequent Advisor

Re: at -f (script) now how to kill?

ps -ef|grep script.sh not showing anything.

I can grep for ps -ef|grep (command in the script), if I kill that next process start.
debjit-India
Frequent Advisor

Re: at -f (script) now how to kill?

ps -ef|grep script.sh not showing anything.

I can grep for ps -ef|grep (command in the script), if I kill that next process start. the script has 220 commands. i killed the cron, but the script still running.
Ricky_HK
Frequent Advisor

Re: at -f (script) now how to kill?

when u run ps -ef, take a look the 3rd column, PPID, which is the parent ID of the process... Trace the parent and parent of parent... I think you can find out one at the top of them... kill this one 1st... the child will not be re-generated...
R.O.
Esteemed Contributor

Re: at -f (script) now how to kill?

You can write a script to kill all the commands in your script. Provided that the command name is in the 1st column of each line in your script, do:

> for i in `cat script.sh |awk '{print$1}'`
> kill -9 $i
> sleep 3
> done

Regards,
"When you look into an abyss, the abyss also looks into you"