Skip to main content
More descriptive title. Rearrange text somewhat and a few rewordings. Markup.
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

Stop/Killkill a Processprocess from Command Linethe command line after a certain amount of time

I have a Python code which listens and detects environmental sounds. It is not my project, I found it on web (SoPaRe). With the ./sopare.py -l command, it starts recording sounds but in infinite loop. When youI want to stop it, youI have to press CTRL+CCtrl+C.

My purpose is to stop this program automatically after 10 seconds, but when I talked with the author and he said, that the program does not have a time limiter. My purpose is to stop this program automatically after 10 seconds etc. 

I tried to kill it via kill PID, but PIDPID changes every time when program workedruns. How can stop it after a time interval via bashbash?

Alternatively, I can execute this command from python with os.system() command.

Stop/Kill a Process from Command Line

I have a Python code which listens and detects environmental sounds. It is not my project I found it on web (SoPaRe). With ./sopare.py -l command, it starts recording sounds but in infinite loop. When you want to stop it, you have to press CTRL+C. I talked with the author and he said, the program does not have a time limiter. My purpose is to stop this program automatically after 10 seconds etc. I tried to kill it via kill PID, but PID changes every time when program worked. How can stop it after a time interval via bash?

Alternatively, I can execute this command from python with os.system() command.

Stop/kill a process from the command line after a certain amount of time

I have a Python code which listens and detects environmental sounds. It is not my project, I found it on web (SoPaRe). With the ./sopare.py -l command, it starts recording sounds but in infinite loop. When I want to stop it, I have to press Ctrl+C.

My purpose is to stop this program automatically after 10 seconds, but when I talked with the author he said that the program does not have a time limiter. 

I tried to kill it via kill PID, but PID changes every time when program runs. How can stop it after a time interval via bash?

Alternatively, I can execute this command from python with os.system() command.

deleted 208 characters in body
Source Link
Rui F Ribeiro
  • 58k
  • 28
  • 156
  • 238

I have a Python code which listens and detects environmental sounds. It is not my project I found it on web (SoPaRe). With ./sopare.py -l command, it starts recording sounds but in infinite loop. When you want to stop it, you have to press CTRL+C. I talked with the author and he said, the program does not have a time limiter. My purpose is to stop this program automatically after 10 seconds etc. I tried to kill it via kill PID, but PID changes every time when program worked. How can stop it after a time interval via bash? If you help me, I will be glad. I'm not only dealing with this program, so I managed all chain via shell script. This is why I'm looking for unix help. Alternatively

Alternatively, I can execute this command from python with os.system() command. You can show via Python, however my first choice is bash.

I have a Python code which listens and detects environmental sounds. It is not my project I found it on web (SoPaRe). With ./sopare.py -l command, it starts recording sounds but in infinite loop. When you want to stop it, you have to press CTRL+C. I talked with the author and he said, the program does not have a time limiter. My purpose is to stop this program automatically after 10 seconds etc. I tried to kill it via kill PID, but PID changes every time when program worked. How can stop it after a time interval via bash? If you help me, I will be glad. I'm not only dealing with this program, so I managed all chain via shell script. This is why I'm looking for unix help. Alternatively, I can execute this command from python with os.system() command. You can show via Python, however my first choice is bash.

I have a Python code which listens and detects environmental sounds. It is not my project I found it on web (SoPaRe). With ./sopare.py -l command, it starts recording sounds but in infinite loop. When you want to stop it, you have to press CTRL+C. I talked with the author and he said, the program does not have a time limiter. My purpose is to stop this program automatically after 10 seconds etc. I tried to kill it via kill PID, but PID changes every time when program worked. How can stop it after a time interval via bash?

Alternatively, I can execute this command from python with os.system() command.

Source Link

Stop/Kill a Process from Command Line

I have a Python code which listens and detects environmental sounds. It is not my project I found it on web (SoPaRe). With ./sopare.py -l command, it starts recording sounds but in infinite loop. When you want to stop it, you have to press CTRL+C. I talked with the author and he said, the program does not have a time limiter. My purpose is to stop this program automatically after 10 seconds etc. I tried to kill it via kill PID, but PID changes every time when program worked. How can stop it after a time interval via bash? If you help me, I will be glad. I'm not only dealing with this program, so I managed all chain via shell script. This is why I'm looking for unix help. Alternatively, I can execute this command from python with os.system() command. You can show via Python, however my first choice is bash.