On Mon, 21.01.13 13:38, Umut Tezduyar (u...@tezduyar.com) wrote: > I would like to start a service on shutdown/restart. This service accesses > (read/write) to the file systems and for that reason I don't want any of > the file systems unmounted by systemd before the service completes.
Right now when you start a service, and you stop another at the same time and they have an ordering dependency (regardless in which direction), then this will cause the stop to be executed first, and the start to be executed second. Currently, this is all you can express with systemd units: you are either not ordered at all or the "stop" is before the "start". That's certainly a limitation, and we have a todo list item to come up with a good, convincing solution for this problem. But so far, we didn't. In the meantime, if you want to start a service at shutdown before other units go down, then one possible solution is to just create a service that is started at bootup, does nothing in ExecStart= and has all interesting bits in ExecStop=. With Type=oneshot, RemainAfterExit=yes it would then nominally stay around during the entire runtime but without any processes or anything else. Then, order this service after local-fs,target and remote-fs.target, and at shutdown it will be run before all mounts go away. This solution should work pretty well. It isn't perfect though, there are probably cases this doesn't cover (though so far we could cover all cases that came up with this scheme, but maybe I missed something?). Also, currently you must specify ExecStart= in a service, even if all you are interested in is ExecStop=. That's a limitation we really should lift though (it's easy, and it's on the todo list...), but in the meantime just invoke /bin/true in ExecStart= and you should be good. Hope that makes some sense. Lennart -- Lennart Poettering - Red Hat, Inc. _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel