5

I saw and tried many solutions.

I used ps aux | grep script.py to get the pid of the process. I got the following output: bioseq 24739 0.0 0.0 112884 1200 pts/1 R+ 13:20 0:00 grep --color=auto /script.py , and then typed: kill 112884 and got the output 112884: No such process.

I also tried a similar command with grep -i, which yielded a different pid. kill <pid> also yielded <pid> No such process.

it's me
  • 51
  • 1
  • 1
  • 4

3 Answers3

6

Try a pkill to kill the process, but you might also check your cron: it's possible that you kill the process but that the crontab restarts it constantly.

Dominique
  • 16,450
  • 15
  • 56
  • 112
  • I didn't run it with cron, just run the script from the terminal. – it's me Sep 02 '20 at 11:02
  • If you run it from the terminal, then you should be able to stop it using that terminal (you can also turn off the terminal). However, there is the possibility that the script subscribed itself to the cron, causing it to repeat itself. So it might be interesting to check crontab settings. – Dominique Sep 02 '20 at 11:13
1
  • First of all, check whether The listed process was probably a zombie process? therefore you cannot kill. Its live-time is depending on its parent process.
  • If you add the u flag to the call of ps, it displays also the STAT column which is Z for zombie processes.
  • if its a zombie process this has perfect explanation How to kill zombie process

if its not a zombie process try this, killall [process name] command. expects a process name, e.g. killall gedit which kills all such processes.

For more refer man killall

Jatin Mehrotra
  • 9,286
  • 4
  • 28
  • 67
1

I believe the process that is shown is the grep process itself which is obviously running when you do the grep but terminates straight after.

So if the process you were looking for was really running, you should see two processes - the actual process, and the grep process you used to look for the process.

e.g. if I run a grep of a completely random string

ps aux | grep wruiogarwiogj

I'd get:

62104 0.0 0.0 408102560 1120 s152 R+ 10:55AM 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox wruiogarwiogj

And there's obviously no actual wruiogarwiogj running.

PulpDood
  • 411
  • 5
  • 9