Re: [systemd-devel] Run cleanup service on stop
On Wed, 4 Nov 2015, at 05:41 PM, Andrei Borzenkov wrote: > Why? It sounds like exact use case for Pre/Post commands. Well, with long lines like: ExecStartPre=/bin/bash -c 'grep -q noclean /etc/webc/cmdline || for d in ~/{.mozilla,.cache,.adobe,.macromedia,Downloads}; do rm -vrf $d; done' ExecStopPost=/bin/bash -c 'grep -q noclean /etc/webc/cmdline || for d in ~/{.mozilla,.cache,.adobe,.macromedia,Downloads}; do rm -vrf $d; done' It looks a little ugly, no? I do realise it could be in a separate shell script. Anyway, I'm keen to learn for completeness sake what I am missing, to trigger a "clean up" service file to execute when stopping my main service. :} Thank you, ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Run cleanup service on stop
03.11.2015 09:21, Kai Hendry пишет: Hi there guys, I have a service where it's important that it cleans up *after* it's run. In fact it's probably a good idea to make sure it's clean *before* it's run too. I got as far as: After=clean.service Requires=clean.service But that does not seem to clean on stop (say if the machine is shutting down). What am I missing? My alternative approach which seems to work is to use: ExecStartPre=... ExecStopPost=... But it looks a little ugly. Why? It sounds like exact use case for Pre/Post commands. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Run cleanup service on stop
Hi there guys, I have a service where it's important that it cleans up *after* it's run. In fact it's probably a good idea to make sure it's clean *before* it's run too. I got as far as: After=clean.service Requires=clean.service But that does not seem to clean on stop (say if the machine is shutting down). What am I missing? My alternative approach which seems to work is to use: ExecStartPre=... ExecStopPost=... But it looks a little ugly. Here is my source: http://s.natalian.org/2015-11-03/service-or-exec.tar Be great to review/critique and suggestions for improvement. I would like to get $HOME onto a private tmpfs going into the future, though I am not sure how to achieve that with systemd. Are there any similar examples I could study? Many thanks, ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel