Skip to content

feat: Mark systemd timers are preferred method#14718

Open
CarlSchwan wants to merge 1 commit intomasterfrom
carl/background
Open

feat: Mark systemd timers are preferred method#14718
CarlSchwan wants to merge 1 commit intomasterfrom
carl/background

Conversation

@CarlSchwan
Copy link
Copy Markdown
Member

systemd timers are the most modern way to configure background jobs and is deeply integrated in journalctl and resources limit can also be easily added.

And move systemd timers and cron to the top, to hopefully ensure less people use webcron/ajax for background jobs.

☑️ Resolves

  • Fix #…

🖼️ Screenshots

✅ Checklist

  • I have built the documentation locally and reviewed the output
  • Screenshots are included for visual changes
  • I have not moved or renamed pages (or added a redirect if I did)
  • I have run codespell or similar and addressed any spelling issues

systemd timers are the most modern way to configure background jobs and
is deeply integrated in journalctl and resources limit can also be
easily added.

And move systemd timers and cron to the top, to hopefully ensure less
people use webcron/ajax for background jobs.

Signed-off-by: Carl Schwan <carlschwan@kde.org>
Copy link
Copy Markdown
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!

This would be worth mentioning at https://github.com/nextcloud/documentation/tree/master/admin_manual/release_notes for admins who upgrade.

**Use case: Single user instance**
If systemd is installed on the system, then systemd timer is the preferred way method for executing
regular tasks. This method enables the execution of scheduled jobs without the
inherent limitations the Web server might have.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
inherent limitations the Web server might have.
inherent limitations the web server might have.


[Timer]
OnBootSec=5min
OnUnitActiveSec=5min
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
OnUnitActiveSec=5min
OnActiveSec=5min

I think we want this, as otherwise a very long running cron would delay the next execution by 5 minutes. If the cron takes a long time, because it has a lot to do, it should run as soon as possible.

[Install]
WantedBy=timers.target

The important parts in the timer-unit are ``OnBootSec`` and ``OnUnitActiveSec``. ``OnBootSec`` will start the timer 5 minutes after boot, otherwise, you would have to start it manually after every boot. ``OnUnitActiveSec`` will set a 5-minute timer after the service-unit was last activated.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would need to be updated too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants