# Publish scheduled pages and posts the moment they are due.
#
# The Content screen runs the same check when it loads, but that only helps
# while somebody is looking at it — a post scheduled for 06:00 has to go live
# at 06:00 on a server nobody is signed in to.
#
# flock -n: a run that overlaps the previous one is skipped rather than queued.
# The job is a no-op when nothing is due, so a minute-ly schedule is cheap.
* * * * * www-data /usr/bin/flock -n /run/lock/alpha-publish.lock /usr/bin/php /var/www/alpha/bin/publish-due.php >/dev/null 2>&1

# Per-post read counts for the blog's Trending / Popular / Weekly best.
# The counts come from the nginx log, which only the panel can parse, so they
# are written out for the public site to read. Hourly: the numbers move slowly
# and the log scan is the expensive part of this. Without the file the blog
# orders by date and shows no counts, rather than inventing any.
17 * * * * www-data /usr/bin/flock -n /run/lock/alpha-blogstats.lock /usr/bin/nice -n 10 /usr/bin/php /var/www/alpha/bin/blog-stats.php >/dev/null 2>&1
