[systemd-devel] How to chain services driven by a timer?

Brian Reichert reichert at numachi.com
Wed Apr 10 14:44:07 UTC 2024


My goal is to implement a service that runs after logrotate.service
completes.

logrotate.service is triggered by a timer logrotate.timer.

I don't want to modify either of logrotate.service or logrotate.timer,
as they are provided by the OS vendor (SLES 12 SP5, in my case.)

I've tried to apply advice I've seen in misc. forums, e.g.:

  https://stackoverflow.com/questions/76314129/how-do-i-configure-systemd-timers-to-run-three-separate-tasks-one-after-the-next

  https://stackoverflow.com/questions/70645559/execute-systemd-service-just-after-another-using-a-timer

But I can't seem to get it to be fired.

The version of systemd on this distribution:

  10-153-68-34:~ # rpm -q systemd
  systemd-228-157.57.1.x86_64

I'd appreciate any guidance.

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

-- 
Brian Reichert				<reichert at numachi.com>
BSD admin/developer at large	


More information about the systemd-devel mailing list