From ad8667c28db6ea061c3787e9a39cbb6ce41e4bdf Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 7 Sep 2025 15:51:09 +0000 Subject: Add setup-imapfilter --- scripts/p7s/systemd.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 scripts/p7s/systemd.py (limited to 'scripts/p7s/systemd.py') diff --git a/scripts/p7s/systemd.py b/scripts/p7s/systemd.py new file mode 100644 index 00000000..3c2270f4 --- /dev/null +++ b/scripts/p7s/systemd.py @@ -0,0 +1,21 @@ +import getpass +import pathlib +import subprocess + + +def create_user_unit(name, content): + user_units = pathlib.Path.home() / ".config" / "systemd" / "user" + user_units.mkdir(exist_ok=True, parents=True) + (user_units / name).write_text(content) + + +def reload(): + subprocess.run(["systemctl", "--user", "daemon-reload"], check=True) + + +def enable_now(unit): + subprocess.run(["systemctl", "--user", "enable", "--now", unit], check=True) + + +def enable_linger(): + subprocess.run(["sudo", "loginctl", "enable-linger", getpass.getuser()], check=True) -- cgit v1.2.3