Before systemd, we had a long-established system for backing up to USB disks when they were plugged in. It did not hold up udev; the initial script started the long-running script in the background and itself terminated. Well sub-second.
When this system was installed on a systemd computer the backgrounded process tree silently disappeared. It was as if the tree had been sent SIGKILL. Nothing in the logs. Finally found
https://forums.opensuse.org/showthre...ly-after-start and learned this is normal under systemd.
The systemd way is to use a systemd service to run the backup. Implemented that.
Decided I did not want the complexity (documentation, sample config files ...) of the backup system being different under systemd so I tried to find a common solution.
The first attempt was to daemonise the previously backgrounded process. Much to my surprise the tree headed by the daemon also silently disappeared.
The next attempt was to run the backup as an at job. Surely that must work. Nope.
From
http://www.freedesktop.org/software/.../man/udev.html "Starting daemons or other long-running processes is not appropriate for udev; the forked processes, detached or not, will be unconditionally killed after the event handling has finished". Just because you are not paranoid does not mean they are not out to get you.
The backup runs perfectly when started at a command prompt and when run from cron. It runs with signals trapped and with stdout and stderr directed to log file so silently disappearing is unexpected.
Has anybody found a way to run udev-initiated long-running processes under systemd without a service?
(I have not yet tried emulating the at job method at a command prompt or of using a cron job instead of an at job)