Since the number of commands that start such a process is limited to
screen/tmux/nohup, these could just be shimmed to do whatever's
needed to let them keep running past logout.

Course it would make more sense to have a proper API that such programs
can use themselves.

I have tried to develop such a shim:

#!/bin/sh
cmd="$(basename "$0")"
# hardcoded path so this shim can be in eg ~/bin/screen and run the real program
systemd-run -q --scope --user /usr/bin/$cmd "$@"

Difficulties with this as it stands:

* loginctl enable-linger needs to be run before the login session
  in which that shim is used, I think?
* I could not get loginctl enable-linger as user to work when logging into the
  server as over ssh:
    Could not enable linger: The name org.freedesktop.PolicyKit1 was not 
provided by any .service files
  Running it as root to enable lingering for a user worked.

-- 
see shy jo, adding ! Systemd.killUserProcesses to his propellor config

Attachment: signature.asc
Description: PGP signature

Reply via email to