From 5eb64f5c3860369b2e8a3bb545dfe8d40dd73c3f Mon Sep 17 00:00:00 2001 From: Mike Cifelli Date: Thu, 4 Apr 2024 10:32:05 -0400 Subject: [PATCH] Show warning if linger is not enabled --- install | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/install b/install index 55b4596..5ea996b 100755 --- a/install +++ b/install @@ -17,6 +17,7 @@ SERVICE_FILE = os.path.join(os.path.expanduser(SYSTEM_DIR), SERVICE) PYTHON = sys.executable EXEC_START = f'{PYTHON} {EXEC}' USER = check_output(['logname']).decode('utf-8').strip() +LINGER = check_output(['loginctl', 'show-user', USER, '--property=Linger']).decode('utf-8').strip() with open(SERVICE_TEMPLATE) as f: serviceTemplate = Template(f.read()) @@ -35,3 +36,6 @@ check_call(['systemctl', '--user', 'daemon-reload']) check_call(['systemctl', '--user', 'enable', '--no-pager', SERVICE]) check_call(['systemctl', '--user', 'restart', '--no-pager', SERVICE]) check_call(['systemctl', '--user', 'status', '--no-pager', SERVICE]) + +if LINGER != 'Linger=yes': + print(f'\n>>> Please run `sudo loginctl enable-linger {USER}` to allow this service to run without being logged in.')