Skip to content

Allow crontab schedule - #756

Open
nocoolnametom wants to merge 1 commit into
stashapp:mainfrom
nocoolnametom:stash-scheduler-cron
Open

Allow crontab schedule#756
nocoolnametom wants to merge 1 commit into
stashapp:mainfrom
nocoolnametom:stash-scheduler-cron

Conversation

@nocoolnametom

Copy link
Copy Markdown

This allows setting the schedule using crontab format

Copilot AI lite review requested due to automatic review settings August 10, 2026 22:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the Stash Scheduler plugin’s “Scan Frequency” setting to accept a standard 5-field crontab expression, enabling more precise scan schedules than the existing hourly/daily/weekly options.

Changes:

  • Update plugin settings help text to document 5-field crontab expressions and their precedence over Time of Day / Day of Week.
  • Add cron-expression detection + validation during settings coercion, persisting the parsed expression as cron_expr.
  • Add a new daemon scheduling branch that uses CronTrigger.from_crontab() when frequency is set to cron mode.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
plugins/stash-scheduler/stash-scheduler.yml Documents crontab scheduling support and clarifies how it interacts with other scheduling settings.
plugins/stash-scheduler/stash_scheduler.py Implements cron-expression detection/validation and adds a cron scheduling path in the daemon and status messaging.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +186 to +190
def _is_cron_expr(value):
"""Return True if value looks like a 5-field crontab expression."""
import re as _re
parts = _re.split(r'\s+', str(value).strip())
return len(parts) == 5 and any(c in value for c in (' ', '\t'))
Comment on lines +197 to +200
raw_freq = str(settings.get("frequency", "daily")).strip()

if _is_cron_expr(raw_freq):
# Validate the cron expression via APScheduler if available; otherwise
@discourse-stashapp

Copy link
Copy Markdown

This pull request has been mentioned on Stash Forum. There might be relevant details there:

https://discourse.stashapp.cc/t/stash-scheduler/7059/3

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants