22 lines
466 B
Python
Executable File
22 lines
466 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import subprocess, os, signal
|
|
from constants import *
|
|
|
|
pid_path = os.path.join("/tmp", PIDFILE)
|
|
|
|
if os.path.exists(pid_path):
|
|
with open(pid_path, "r") as pid_file:
|
|
kill_pid = pid_file.read().strip()
|
|
|
|
try:
|
|
os.kill(int(kill_pid), signal.SIGINT)
|
|
|
|
os.unlink(pid_path)
|
|
|
|
print("Stopped stream")
|
|
except Exception as err:
|
|
print("Error occured while killing process:", repr(err))
|
|
else:
|
|
print("No pidfile found")
|
|
# else do nothing I guess |