Re: How to chain services driven by a timer?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 10, 2024 at 8:50 AM Brian Reichert <reichert@xxxxxxxxxxx> wrote:
>
> My current service file:
>
>   [Unit]
>   Description=Activities after logrotation
>
>   Requires=logrotate.service
>   Wants=logrotate.service
>   After=logrotate.service
>
>   [Service]
>   #Type=oneshot
>   Type=simple
>
>   ExecStart=/usr/bin/logger 'XXX post log rotation'
>
>   [Install]
>   WantedBy=timers.target

The critical part is WantedBy=logrotate.service. In other words, when
logrotate.service is activated, you want it to also activate your
service. Then After=logrotate.service above will ensure your service
starts after it completes. The Requires and Wants above are
conflicting. You only want one or the other, but I'd probably put it
as Requires=logrotate.service. That way your unit won't start if
logrotate.service fails.




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux