Show warning if linger is not enabled
This commit is contained in:
parent
0b21da8145
commit
5eb64f5c38
4
install
4
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.')
|
||||
|
|
Loading…
Reference in New Issue