[systemd-devel] Starting service conditionally and retrying when failure
Camilo Aguilar
camilo.aguilar at gmail.com
Thu Oct 5 05:13:39 UTC 2017
you need to active your service unit when your files show up by monitoring
the path using an additional path unit:
https://www.freedesktop.org/software/systemd/man/systemd.path.html
On Thu, Oct 5, 2017 at 12:59 AM sdrb <sdrb at onet.eu> wrote:
> Hi,
>
> I'd like to ask how to achieve following functionality in systemd:
>
> I'd like to start alsa-restore.service only once just after one of the
> specified files appears. Those file matches: /dev/snd/control*.
>
> For now I have something like this:
>
> [Unit]
> Description=Save/Restore Sound Card State
> ConditionPathExistsGlob=/dev/snd/control*
> After=sysinit.target
>
> [Service]
> Type=oneshot
> RemainAfterExit=true
> ExecStart=-/sbin/alsactl restore -f /etc/asound.state
>
> [Install]
> WantedBy=multi-user.target
>
>
> but during the start when there is no any of /dev/snd/control* files -
> the condition is not meet and the service is not going up.
> Those files appears later.
>
> So that what I'd like to achieve is to wait for appearing of those files
> and then starting alsa-restore service.
>
> Is it possible to do in systemd? If yes - how to do this?
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
--
*Camilo Aguilar*
Software Engineer
http://github.com/c4milo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20171005/df141d00/attachment.html>
More information about the systemd-devel
mailing list