2

I am scheduling, say, 3 commands using at command.

$ at teatime
 command1
 command2
 command3
 <Ctrl + D>

After some time I realised that running command3 is not really what I wanted, but at same time I don't want remaining commands to stopped from execution.

I tried looking for at command or something like it in System Monitor so that I could kill process responsible for running command3 but couldn't find (maybe I am wrong in this). Also I can stop ATD daemon that runs these commands but that will stop all commands from execution, which is not what I wanted.
Is there any other way to stop just command3 ?

1 Answer 1

3

The easiest solution would be to cancel all three and re-schedule the ones you want executed. atq will show you the list of queued tasks, at -c will show you one queued task by number, and atrm will remove one task by number.

Your underlying problem is that everything from invocation of at to the ctrl-d is, in essence, put into a single shell script, which usually resides somewhere under /var/spool, and I think that at has some protection against these files being modified after being submitted, though I do not recall the details. (I guess that could be tried out experimentally if you have root access on your machine -- find the file containing your commands and comment out the one you don't want to execute.)

3
  • can you please give me reference from where did you get this information?
    – Alex Jones
    Feb 3, 2016 at 17:14
  • 1
    I looked at the source code of at and atd at some point -- it's fairly short and fairly well-commented (if you ignore things like the time parsing code). Feb 3, 2016 at 17:26
  • 1
    Here's the source online, and I must apologize -- actually there seems not to be any protection of the scheduled jobs apart form the fact that permissions on /var/spool/atjobs are fairly restrictive. Feb 3, 2016 at 18:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .