On Feb 28, 2021, at 12:13, Patrick O'Callaghan <pocallag...@gmail.com> wrote:
> 
> Is there a way to invoke scripts before auto-mounting and after auto-
> unmounting? I want to be able to power an external drive up and down as
> needed.

Your .mount unit would need a Before= and After= Section.  Refer to a systemd 
.service that you will create that is Type=oneshot, where the ExecStart= powers 
on the device and ExecStop= powers it off.  I think you’ll need a 
RemainAfterExit=yes in that service too, so systemd thins it is “up” while the 
device is powered up.

I don’t know how the power up sequence works, but if the power up command exits 
before it is powered on, you might need to work some sleep or wait command to 
only have the service “up” when the device is ready, that way the mount won’t 
be attempted until it is ready.

— 
Jonathan Billings
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to