On Wed, 19.10.16 12:46, Kamil Jońca (kjo...@o2.pl) wrote: > > Assume we have openvpn.service. > This service neccessary only when I want to connect to my work from > home. > > Is it possible to make user target which will be automatically run this > service?
Whenever a user logs in it will get a per-user slice unit started. When the user logs out, the slice unit is removed. You could make sure that your service is pulled in by this slice when the slice is started (and hence at login) and stopped whenever the slice is stopped (i.e. at last logout). There's no particularly nice scheme for that in place, but if you have well-established UIDs, it would be as easy as dropping in a symlink /etc/systemd/system/user-1000.slice.wants/<yourservice.service> pointing to your main service file. Then, inside that file, add dependencies back to the slice, i.e. something like BindsTo=user-1000.slice.... I hope you get the idea of what I am suggesting here... Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel