You can abuse the fact that systemctl has the edit subcommand. It meant to modify the existing service file, but nothing means you can't just save it out elsewhere and then modify it.
Additionally, if it's a long running service it should be located where other systemd unit files are located (`$HOME/.config/systemd/user/` for user units, `/etc/systemd/system/` for service units) and just copy them while the unit is still running.
systemd-run --user -u test -t bash
cp $HOME/systemd/user/test.service /new/path/for/test.service
Theoretically one-shot service that launches a shell script with systemd run on boot could do the trick. OTOH it's probably easier to just write a tiny service at that point.
Generally results of -run services can be captured through journalctl, so it's possible to run systemctl show on them and get the config.
zamubafoo|2 years ago
You can abuse the fact that systemctl has the edit subcommand. It meant to modify the existing service file, but nothing means you can't just save it out elsewhere and then modify it.
Additionally, if it's a long running service it should be located where other systemd unit files are located (`$HOME/.config/systemd/user/` for user units, `/etc/systemd/system/` for service units) and just copy them while the unit is still running.
Of course this requires it to live long enough.VTimofeenko|2 years ago
Generally results of -run services can be captured through journalctl, so it's possible to run systemctl show on them and get the config.