Questions tagged [pkill]

33 questions
36
votes
12 answers

How stop after running react-scripts start?

I started a React app with npm start with start defined in package.json: { "name": "testreactapp", "version": "0.1.0", "private": true, "dependencies": { "react": "^15.6.1", "react-dom": "^15.6.1", "react-scripts": "1.0.10" …
user1837293
  • 1,466
  • 3
  • 16
  • 30
24
votes
3 answers

Pkill -f doesn't work for process killing

I have this process running: 342 pts/2 T 0:00 sh -c sudo screen /usr/bin/python /usr/bin/btdownloadcurses "http://zoink.it/torrent/732A4A9B54B7E3A916C2835D936D985942F65A6D.torrent" --display_interval 20 --saveas "/srv/" 343 pts/2 T 0:00…
Lim zhen xiang
  • 241
  • 1
  • 2
  • 5
6
votes
0 answers

Killing a subtree of processes in linux bash

i am typing a small bash script which should clone a git repository, checkout a specific hardcoded branch and listen for some new commits. If new commits are found the script should kill a running instance of 'MyApp', do a git pull and finally build…
user8357485
5
votes
1 answer

pkill returns 255 in combination with another command via remote ssh

When I try to execute pkill on a remote host in combination with another command, it always returns 255, even though both the commands were successful. Examples ssh 'pkill -f xyz' # returns 0 (rightly so when xyz is a process) ssh…
2
votes
1 answer

`pkill` and static objects destruction in C++

There is a C++ structure having static instance: class A { public: A () {} ~A() { // smth. } } a; Does pkill of process calls destructors of all static objects implemented in C++? Is there a guarentee that pkill, before process…
Martin Ayvazyan
  • 429
  • 1
  • 5
  • 16
2
votes
2 answers

killproc command not found error in Ubuntu 12.04

I have a redmine script in /etc/init.d/ folder which was working fine before I broke the ruby and rails packages link. Then I played with ruby gems and finally fixed the broken links. Then I tried to restart redmine script, But strangely, I got the…
Kenshin
  • 1,030
  • 2
  • 12
  • 41
1
vote
1 answer

Do driver.quit() and pkill chrome have the same effect in releasing memory?

I have a Python script that uses Selenium to do some web-page clicking and scraping. Script is running on Ubuntu, running on an EC2 instance. The basic code: from selenium import webdriver from bs4 import BeautifulSoup as bs import datetime from…
DiamondJoe12
  • 1,879
  • 7
  • 33
  • 81
1
vote
1 answer

Why pkill return -9?

I want to run command pkill -9 -f 'java.*7104' in python3 use subprocess.run, but I do not know why returncode=-9, can anyone explain this? >>> subprocess.run("pkill -9 -f 'java.*7104'", shell=True) CompletedProcess(args="pkill -9 -f 'java.*7104'",…
Ren
  • 2,852
  • 2
  • 23
  • 45
1
vote
1 answer

Why does running "pkill -f " over ssh fail only when branching on its result?

Found an interesting interaction between pkill and ssh. Documenting it here for posterity: $ ssh user@remote 'false'; echo $? 1 $ ssh user@remote 'false || echo "failed"'; echo…
0x5453
  • 12,753
  • 1
  • 32
  • 61
1
vote
1 answer

How kill several subprocesses with the same name, with Python3

With Raspberry Pi and Python3 I get these subprocess: ps -aux | grep python3 pi 4168 0.9 0.7 11088 7304 ? S 18:31 0:00 python3 blue.py pi 4175 1.2 0.7 11088 7300 ? S 18:33 0:00 python3 blue.py pi 4185 2.4 0.7 …
canel
  • 81
  • 2
  • 7
0
votes
2 answers

Unable to pkill a subprocess

Consider: import subprocess import time def run_instance(): command = "sleep 30 >out 2>err &" subprocess.check_output(command, shell=True, start_new_session=True) def kill_instance(): print(subprocess.check_output(f"pgrep -f 30",…
AlwaysLearning
  • 7,257
  • 4
  • 33
  • 68
0
votes
1 answer

Linux short simple command how to send SIGTERM to a process and SIGKILL if it fails to exist in X seconds?

How should look the Linux command to send terminate signal to the process/PID and if it fails to exit gracefully after 10 seconds kill it? My attempt is: "sudo timeout -vk 5 10 kill PIDhere" (-v verbose, -k kill after X seconds) but I am not sure if…
16851556
  • 255
  • 3
  • 11
0
votes
2 answers

How to stop all background processes(running functions) by using Trap?

I have two long running functions which needs to be executed asynchronously. For simplicity, assume one function sends Mail to client every 10 seconds & other logs text file every two seconds. I cannot use cron jobs to do this. Everything has to be…
Mysterious Jack
  • 621
  • 6
  • 18
0
votes
1 answer

How python subprocess can detect a negative exit code? How to force it return 0 instead?

I'm using pkill to send USR2 signal to suricata by python subprocess as below: #!/usr/bin/python3 script_command='pkill -SIGUSR2 -f /usr/bin/suricata' exit_status = subprocess.call(script_command, env=self.config_environment, shell=True) the…
0
votes
1 answer

pkill given process depending on input arguments

I have a python process running, called test.py that I run from a bash script with input parameters. $PWD/test.py -s $symbol -folder $folder -n $name -d $name Once running ps -elf | grep test.py, the process appears with the parameters. I am…
JejeBelfort
  • 1,593
  • 2
  • 18
  • 39
1
2 3