I started a script on a server using "at": at now < script.sh My problem is, that the script repeatedly starts new processes. Is it possible to stop the whole script instead of killing the single processes using "top"? I can not find the running script using "top", "bg" or "ps aux". I could not find a solution using google, only solutions to kill foreground jobs are offered.

Killing the process id at now < script.sh & spills out does not work either:

user@linux:$ at now < script.sh &
[1] 16428
warning: commands will be executed using /bin/sh
user@linux:$ job 3 at Sat Sep 10 11:58:00 2016

[1]+  Fertig                  at now < script.sh
user@linux:$ kill 16428
bash: kill: (16428) - Kein passender Prozess gefunden

"Kein passender Prozess gefunden" means "no matching process found".

  • What if you did at now < script.sh & and killed the PID it spits out? – cutrightjm Sep 9 '16 at 21:47
  • The at program just submits your commands for execution and exits immediately, so its pid is useless; the execution is done by a different process(es). While running it(they) should show in BSD-style ps ax but might be easier to find if you use ATT-style ps -fu yourusernameornumber and focus on the entries with ? under TTY. – dave_thompson_085 Sep 10 '16 at 11:52
  • you confuse & ( background job/process in same shell ) and at (detached shell). I would advise to use either at now < script.sh or script.sh & depending on your need. – Archemar Sep 12 '16 at 13:01

dave_thompson_085 is correct with his comment. Using ps -fu yourusernameornumber I could find the script's processes (including PID) called "sh". I could stop them by kill <PID>.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.