easyconf-lemonbar/easyconf_lemonbar/pidfile.py

15 lines
344 B
Python

from os import chmod, getpid, getuid, remove
def pidfile_name():
filepath = "/run/user/" + str(getuid()) + "/easyconf-lemonbar.pid"
return filepath
def create_pidfile(filepath):
with open(filepath, "w") as file:
file.write(str(getpid()))
chmod(filepath, 0o644)
def delete_pidfile(filepath):
remove(filepath)