I have 4 oneshot systemd services. Two of them for backing up some directories, 2 other for checking those backups. If any of those services tries to run while another is running, it will fail. How do I make it so that no 2 of these services ever run at the same time?

  • Maybe use ConditionPathExists= with a file as primitive locking mechanism?
    – muru
    Jul 21, 2019 at 2:59
  • Do the backups take very long to complete? I note the systemd documentation: "it is generally not recommended to use idle or oneshot for long-running services". What triggers the services to start?
    – Jeff Schaller
    Jul 24, 2019 at 17:40
  • It'd be useful to know whether the RemainAfterExit option is set for these services, as well.
    – Jeff Schaller
    Jul 24, 2019 at 17:41


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.