Questions tagged [pkill]

33 questions
0
votes
1 answer

If Statement to Kill Program at User Set Time - Bash

wrote a script that accepts user input for time and is supposed to kill a program when the current time is equal to the time the user input. it's broken down to: read -p "Enter when your class ends in the format 00:00 " endclass echo "We will close…
0
votes
0 answers

shelljs.exec(`sudo pkill -P ${process.pid}` did not work in ubuntu

I have a python module that work with webcam by opencv in ubuntu. I should execute it from nodejs so I use shelljs package and run shell.exec('sudo pkill -P ${pythonProcess.pid}'). It does not close webcam otherwise it working in terminal of ubuntu.…
r.a.shehni
  • 350
  • 1
  • 4
  • 11
0
votes
0 answers

Python close Loop for Chrome in Ubuntu

I try this code, it runs proberly but doesnt kill chrome browser. What am i doing wrong? import schedule import time def job(): print("Kill Chrome in Progress..") 'pkill chrome' print("Sucessfully killed…
0
votes
1 answer

pkill does not seem to remove dpkg process in Ubuntu 18.04 LTS

I'm currently using Ubuntu 18.04 LTS, and I am trying to install GitLab via the instructions on https://www.linode.com/docs/development/version-control/install-gitlab-with-docker/. Initially, I was following the instructions to download and install…
Stoner
  • 846
  • 1
  • 10
  • 30
0
votes
0 answers

why pkill is not killing the command python blink_led.py&

I run a command : python blink_led.py & Then I try to kill it with pkill pkill blink_led.py But it doesn't work Even after checking man page, I don't understand how pkill works
Juliatzin
  • 18,455
  • 40
  • 166
  • 325
0
votes
0 answers

Is there a way to prevent the creation of any processes matching a pattern?

I'd like to know if there's a way (maybe in .bash_profile?) to prevent the creation of any child processes with names matching a regex. In particular, examining output from ps -ax I am finding extra processes started by tools that I use, which I do…
0
votes
2 answers

How to make the callback example run in bash?

I had read a discussion on bash's callback,jlliagre post an amazing example. callback example posted by jlliagre Recite the main points here. 1.Create callback-example and run it on terminal with ./callback-example. #!/bin/bash myCallback() { …
user7988893
0
votes
1 answer

pkill isn't fully killing process?

I'm doing some testing with flock and pkill for a test.sh script that I'm calling from cron and I ran into something I don't understand. The test.sh is scheduled as a * * * * * job in cron. Its a very simple script that for testing purposes writes a…
sjaak
  • 644
  • 1
  • 7
  • 18
0
votes
0 answers

pkill not working in system() command

I am trying to kill a process in a C++ program (Linux). I know exactly the name of the program to kill. If I try in Bash pkill process-name the process is killed normally. If in a simple C++ program I run in main system("pkill process-name") the…
Talkanian
  • 19
  • 1
  • 5
0
votes
1 answer

Using pkill, how can I find out how many processes matched

We may not know how many processes actually died as a result of a pkill command, but is there a way to echo how many processes matched? pkill -f "bin/ql_node_server" is there a switch to pkill that will echo how many processes matched? on MacOS, if…
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
0
votes
2 answers

Pass bash command a comment to see from pkill

I have an aribtrary bash command being run that I want to attach some identifying comment to so that I may pkill it if necessary. For example: sleep 1000 #uniqueHash93581 pkill -f '#uniqueHash93581' ... but the #uniqueHash93581 does not get…
cars
  • 421
  • 7
  • 18
0
votes
0 answers

Quit Ubuntu Application by "clicking" the x-Button via Terminal

I am trying to quit a program with a bash script. The problem is that it has to be quit via the the x-button to save some settings. So pkill program do not work in my case. I know that I have to sent a signal for the x-button but I can not find…
vktrbhm
  • 35
  • 5
0
votes
0 answers

How to restart a program in ubuntu using cron?

I'd like to restart a program regardless of it already running or not using crontab. I have this in crontab -e * * * * * /usr/bin/pkill -f myapp; /home/ubuntu/xyz/bin/res.sh And in the res.sh #!/bin/bash /usr/bin/pkill -f myapp sleep…
Questions
  • 195
  • 1
  • 14
0
votes
1 answer

Pkill guarantees

Can pkill guarantee the following situation never happens: I use pkill -f "abc" pkill finds process by name and remembers pid process ends Linux starts a new process with the same pid pkill kills the process started at step 4
Don Per In
  • 19
  • 1
0
votes
2 answers

pkill wild card in user name

I have a gitlab process running under the username gitlab-+. I would like to kill all processes from the user. When I try: pkill -9 -u gitlab-+ It comes back with invalid user name. I tried pkill -9 -u gitlab* with the same result. How can I…
Luca
  • 10,458
  • 24
  • 107
  • 234