[prev in list] [next in list] [prev in thread] [next in thread] 

List:       systemd-devel
Subject:    [systemd-devel] Running a service at shutdown time before file systems are unmounted
From:       david () davidstrauss ! net (David Strauss)
Date:       2012-07-28 2:23:43
Message-ID: CAKz8sYUJhPnwu+UP2BHLeAZFo84PcVnm-kHpq=dRaamecPa9Gg () mail ! gmail ! com
[Download RAW message or body]

On Fri, Jul 27, 2012 at 6:08 PM, Manuel Amador (Rudd-O)
<rudd-o at rudd-o.com> wrote:
> I need to run a program right before any file system is unmounted, to record
> the current file system state on disk.

I would create a Type=oneshot, RemainAfterExit service with WantedBy=
and After= the mount. You may need to re-"enable" the service or the
mount to get the dependency properly rigged. It's probably possible
for it to have something like "echo" as the ExecStart= and your
utility as the ExecStopPost=. This would cause the service to be
started and "running" when the mount starts up and shut down and run
ExecStopPost before the mount goes away.

I have not tested any of this, but it's the best I can come up with
for allowing clean dependency injection for an arbitrary command to
run before stopping a mount.

-- 
David Strauss
   | david at davidstrauss.net
   | +1 512 577 5827 [mobile]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic