<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Coder Legion - Recent posts tagged cron</title>
<link>https://coderlegion.com/tag/cron</link>
<description>Powered by Question2Answer</description>
<item>
<title>TTFB Won't Go Down? Server-Side Culprits Beyond the Theme</title>
<link>https://coderlegion.com/25143/ttfb-wont-go-down-server-side-culprits-beyond-the-theme</link>
<description>&lt;p&gt;You moved the site behind a CDN, trimmed the theme, deferred scripts, and ran a caching plugin. PageSpeed Insights still flags a high Time to First Byte on the homepage, and the waterfall shows most of the wait in Waiting (TTFB) rather than DNS or TLS. The next ticket proposes a bigger hosting plan; in our experience that upgrade often treats the symptom while the origin keeps doing too much work per request, or background jobs steal capacity when real visitors arrive.&lt;/p&gt;&lt;p&gt;What follows is a server-side checklist for WordPress and PHP stacks when you need to reduce TTFB after delivery-layer fixes. We focus on origin compute and scheduling: cron, workers, cache, database, and maintenance plugins. For DNS, TLS, HTTP, and CDN cache rules, start with &lt;a rel=&quot;nofollow&quot; href=&quot;https://apogeewatcher.com/blog/network-performance-dns-tls-http-cdn-cache-rules&quot;&gt;Network Performance for Web Teams: DNS, TLS, HTTP, CDN, and Cache Rules&lt;/a&gt;. For cases where application code beats infrastructure, see &lt;a rel=&quot;nofollow&quot; href=&quot;https://apogeewatcher.com/blog/wordpress-site-slow-not-always-hosting&quot;&gt;Why Your WordPress Site Is Slow (It Is Not Always Hosting)&lt;/a&gt;.&lt;/p&gt;&lt;h2 id=&quot;when-slow-server-response-time-is-not-a-theme-or-cdn-problem&quot; class=&quot;scroll-mt-24&quot;&gt;When slow server response time is not a theme or CDN problem&lt;/h2&gt;&lt;p&gt;Lighthouse and PageSpeed Insights label high first-byte time as Reduce initial server response time. The diagnostic measures how long the browser waits after the request leaves the client until the first byte of the HTML response arrives. When DNS, connect, and TLS are already short, the remaining delay is almost always origin processing: PHP execution, database queries, remote API calls inside the page build, or contention from other jobs on the same machine.&lt;/p&gt;&lt;p&gt;That pattern is common on WordPress sites that look optimised in the front end but still regenerate HTML on every uncached hit. A page cache can hide the problem until a cache miss, a logged-in session, a cart cookie, or a query-string variant bypasses the edge, so your lab test shows a high TTFB while marketing reports “the CDN is on.” Treat those misses as the path that matters, not the cached marketing homepage.&lt;/p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;Symptom in lab or RUM&lt;/th&gt;&lt;th&gt;Likely layer&lt;/th&gt;&lt;th&gt;First place to look&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;High Waiting, low DNS/TLS&lt;/td&gt;&lt;td&gt;Origin PHP / app&lt;/td&gt;&lt;td&gt;Object cache, query count, cold workers&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Spikes at the top of each hour&lt;/td&gt;&lt;td&gt;Scheduled tasks&lt;/td&gt;&lt;td&gt;WP-Cron, backup, search indexers&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Slow only when editors are logged in&lt;/td&gt;&lt;td&gt;Uncached admin bar / personalised HTML&lt;/td&gt;&lt;td&gt;Page cache exclusions, admin-ajax&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Slow on `/?` and `?nocache=1` only&lt;/td&gt;&lt;td&gt;Full page cache working elsewhere&lt;/td&gt;&lt;td&gt;Origin path above&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Slow after deploy, fine after warm-up&lt;/td&gt;&lt;td&gt;Cold opcode / PHP workers&lt;/td&gt;&lt;td&gt;OPcache, worker count, warm scripts&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;If your waterfall still shows long DNS or TLS phases, fix the network stack first; the sections below assume those hops are already reasonable.&lt;/p&gt;&lt;h2 id=&quot;how-wordpress-wp-cron-inflates-time-to-first-byte&quot; class=&quot;scroll-mt-24&quot;&gt;How WordPress WP-Cron inflates time to first byte&lt;/h2&gt;&lt;p&gt;WordPress schedules many tasks through WP-Cron, which is not a system daemon. On default setups, &lt;code&gt;wp-cron.php&lt;/code&gt; runs on page requests: a visitor or bot triggers due jobs before WordPress serves the page they asked for. Heavy plugins add hooks for imports, sitemap builds, newsletter sends, and housekeeping that can run for seconds on shared hosting, which is why support threads about WordPress TTFB and cron keep resurfacing. A backup finishing at 09:00, a search indexer at :15 past the hour, and a security scan at :30 can stack into the same traffic window, so editors notice the site feels slow while cron owns the CPU.&lt;/p&gt;&lt;p&gt;Practical fixes, in order of leverage:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;p&gt;Disable request-driven WP-Cron in &lt;code&gt;wp-config.php&lt;/code&gt; (&lt;code&gt;define('DISABLE_WP_CRON', true);&lt;/code&gt;) and trigger &lt;code&gt;wp cron event run --due-now&lt;/code&gt; from system cron on a fixed interval (every five or fifteen minutes, not on every page view).&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Audit scheduled events with &lt;code&gt;wp cron event list&lt;/code&gt; (WP-CLI) or a cron inspector plugin in staging. Remove or reschedule plugins that register hourly full-table scans on production.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Stagger plugin schedules so backup, analytics aggregation, and link checkers do not share the same minute.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Run long jobs off-peak in the site’s traffic timezone, not the agency’s office hours.&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;After changes, compare TTFB on the same URL at :05 and :55 past the hour; if the spread collapses, cron was the culprit rather than the theme or CDN.&lt;/p&gt;&lt;h2 id=&quot;php-workers-opcode-cache-and-origin-saturation&quot; class=&quot;scroll-mt-24&quot;&gt;PHP workers, opcode cache, and origin saturation&lt;/h2&gt;&lt;p&gt;Even with clean cron, each uncached HTML request needs a PHP worker to execute WordPress. On FPM pools with few children, a burst of concurrent visitors queues behind a small worker count, and cold workers (first request after idle, or after deploy) pay bootstrap cost: loading WordPress core, autoloaded options, and dozens of plugin files before your theme renders one line. The checklist below covers the worker and opcode issues we see most often on agency WordPress stacks.&lt;/p&gt;&lt;p&gt;Checklist for worker and opcode issues:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;OPcache enabled with enough memory and &lt;code&gt;validate_timestamps&lt;/code&gt; tuned for your deploy flow (revalidate in dev; stable in prod).&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Realpath cache and sensible &lt;code&gt;pm.max_children&lt;/code&gt; for traffic (too low queues; too high can exhaust RAM and swap).&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Separate pools for admin, AJAX, and front-end when the host allows it, so &lt;code&gt;admin-ajax.php&lt;/code&gt; storms do not starve public pages.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Warm critical URLs after deploy (homepage, top landing pages, cart) before announcing release.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Origin saturation also appears when the same server runs mail, staging sync, or backup restores alongside production. Slow server response time in that case is capacity planning, not a tweak to a single plugin, but right-sizing workers and separating batch work often beats doubling CPU without touching cron or object cache.&lt;/p&gt;&lt;h2 id=&quot;database-load-object-cache-and-n1-queries-on-uncached-requests&quot; class=&quot;scroll-mt-24&quot;&gt;Database load, object cache, and N+1 queries on uncached requests&lt;/h2&gt;&lt;p&gt;WordPress without a persistent object cache hits the database for autoloaded options, post meta, and taxonomy on nearly every request. Plugins that add large autoload rows or run wide queries on &lt;code&gt;init&lt;/code&gt; multiply that cost, and page builders with dynamic blocks can trigger N+1 query patterns when a single template loads dozens of posts or meta keys per view. Those queries run before the first byte leaves the server, so they show up directly in Waiting time rather than as a front-end script problem.&lt;/p&gt;&lt;p&gt;Signs the database is dominating TTFB:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;Query Monitor (staging) shows hundreds of queries on the homepage.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;code&gt;wp_options&lt;/code&gt; autoload size is megabytes (transients and plugin settings that never clean up).&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Slow query log spikes on &lt;code&gt;wp_postmeta&lt;/code&gt;, &lt;code&gt;wp_options&lt;/code&gt;, or custom tables from analytics plugins.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Mitigations that actually move first byte:&lt;/p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;Issue&lt;/th&gt;&lt;th&gt;Fix&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;No object cache&lt;/td&gt;&lt;td&gt;Redis or Memcached with a drop-in (`object-cache.php`)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Fat autoload&lt;/td&gt;&lt;td&gt;Audit `autoload=yes` options; remove stale plugin rows&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;N+1 in theme or plugin&lt;/td&gt;&lt;td&gt;Batch queries, lazy load blocks, or cache fragment output&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Missing indexes on custom tables&lt;/td&gt;&lt;td&gt;Add indexes in staging; measure before prod&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Remote HTTP inside `the_content` filters&lt;/td&gt;&lt;td&gt;Remove or cache API responses with short TTL&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;Object cache does not replace a full-page cache, but it cuts origin work on partial misses and logged-in routes, so pair database wins with &lt;a rel=&quot;nofollow&quot; href=&quot;https://apogeewatcher.com/blog/performance-budget-thresholds-template&quot;&gt;Performance Budget Thresholds Template&lt;/a&gt; on templates that must stay dynamic (checkout, account, enrolment).&lt;/p&gt;&lt;h2 id=&quot;admin-ajax-storms-backup-plugins-and-maintenance-during-peak&quot; class=&quot;scroll-mt-24&quot;&gt;admin-ajax storms, backup plugins, and maintenance during peak&lt;/h2&gt;&lt;p&gt;Two other WordPress-specific patterns keep server response time high without touching the theme CSS. &lt;code&gt;admin-ajax.php&lt;/code&gt; handles heartbeat, cart fragments, live search, and page-builder autosaves; a misconfigured plugin polling every few seconds from the front end can keep workers busy and add latency to unrelated pages on small pools. In staging, watch access logs for &lt;code&gt;admin-ajax.php&lt;/code&gt; volume during a normal editor session, disable heartbeat on the front end where safe, fix plugins that hammer AJAX on public pages, and rate-limit bots that target &lt;code&gt;wp-login.php&lt;/code&gt; and AJAX endpoints.&lt;/p&gt;&lt;p&gt;Backup and migration plugins (UpdraftPlus, Duplicator, All-in-One WP Migration, and host scheduled snapshot tools) can lock tables or saturate disk I/O during business hours. Schedule backups when analytics show the lowest concurrent users, not at local midnight on the server if that is peak in the site’s country, and test restore windows separately from performance testing because a backup run is not a deploy. Security scanners and link-checker plugins that crawl the whole site on cron belong in the same bucket: if TTFB spikes line up with their schedule in the cron list, move or throttle them before buying hardware.&lt;/p&gt;&lt;h2 id=&quot;how-to-verify-ttfb-fixes-without-guessing&quot; class=&quot;scroll-mt-24&quot;&gt;How to verify TTFB fixes without guessing&lt;/h2&gt;&lt;p&gt;Use the same priority URL and device profile before and after each change. In WebPageTest or Chrome DevTools, confirm Waiting shrank while DNS and SSL stayed flat, and run at least twice: once during a quiet minute and once when cron used to fire. For WooCommerce and membership sites, repeat on cart and checkout URLs, not only the homepage.&lt;/p&gt;&lt;p&gt;Scheduled PageSpeed monitoring catches regressions when a plugin update re-enables request-driven cron or adds autoload bloat. &lt;a rel=&quot;nofollow&quot; href=&quot;https://apogeewatcher.com/blog/pagespeed-insights-vs-automated-monitoring-when-manual-checks-arent-enough&quot;&gt;PageSpeed Insights versus automated monitoring&lt;/a&gt; explains why one-off lab pastes miss hour-of-day effects, while field TTFB in CrUX moves on a 28-day window and lab TTFB on your uncached path tells you whether today’s origin fix worked. Document what you changed (cron mode, object cache, backup window) in the client runbook so the next agency does not optimise the theme again while the server still runs fifty due cron events at noon.&lt;/p&gt;&lt;h2 id=&quot;faq&quot; class=&quot;scroll-mt-24&quot;&gt;FAQ&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;What is a good TTFB for WordPress?&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;There is no single magic number. Google’s &lt;a rel=&quot;nofollow&quot; href=&quot;https://web.dev/articles/optimize-ttfb&quot;&gt;optimize TTFB&lt;/a&gt; guidance treats sub-800 ms as a reasonable target for the HTML document on the network path you control, and stricter shops aim lower on cached marketing pages. Compare your origin miss path, not only the CDN hit, because a fast edge response on a cached homepage can hide a slow uncached checkout.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Does a CDN always reduce TTFB?&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;No. A CDN lowers TTFB on cache hits, but on misses HTML still builds at origin. Fix origin compute first if misses are common or if personalised cookies bypass cache, because a green Lighthouse score on the cached homepage will not help checkout.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Should I disable WP-Cron on every site?&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;For production sites with real traffic, system cron plus &lt;code&gt;DISABLE_WP_CRON&lt;/code&gt; is the usual best practice. Keep request-driven cron only where you cannot schedule CLI (some locked-down hosts), and even then reduce due events rather than accepting page-triggered jobs on every visit.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Is high TTFB a Core Web Vital?&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;TTFB is not one of the three Core Web Vitals (LCP, INP, CLS), but it still affects LCP because the main content cannot paint until HTML arrives. See &lt;a rel=&quot;nofollow&quot; href=&quot;https://apogeewatcher.com/blog/lcp-inp-cls-what-each-core-web-vital-means-and-how-to-fix-it&quot;&gt;LCP, INP, and CLS explained&lt;/a&gt; for how first byte fits the wider picture.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;When is upgrading hosting the right fix?&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;When profiling shows sustained CPU or memory limits after cron, cache, and query fixes, or when traffic outgrew the plan honestly. If doubling RAM fixes TTFB without code changes, you probably skipped object cache or cron discipline first, so rerun the checklist above before signing a larger contract.&lt;/p&gt;&lt;hr&gt;&lt;p&gt;When CDN, TLS, and theme tickets are closed and TTFB is still high, walk this server-side list before the next hosting invoice. Apogee Watcher schedules PageSpeed runs on the URLs that bypass cache so you see origin truth, not only the fast cached homepage.&lt;/p&gt;&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://apogeewatcher.com/sign-up&quot;&gt;Start monitoring your client sites&lt;/a&gt; or &lt;a rel=&quot;nofollow&quot; href=&quot;https://apogeewatcher.com/check&quot;&gt;run a free performance check&lt;/a&gt; on an uncached priority URL.&lt;/p&gt;&lt;h2 id=&quot;references&quot; class=&quot;scroll-mt-24&quot;&gt;References&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://web.dev/articles/optimize-ttfb&quot;&gt;Optimize Time to First Byte&lt;/a&gt; (web.dev)&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://web.dev/articles/ttfb&quot;&gt;Time to First Byte (TTFB)&lt;/a&gt; (web.dev)&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://developer.chrome.com/docs/lighthouse/performance/server-response-time&quot;&gt;Reduce server response times&lt;/a&gt; (Chrome for Developers)&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://developers.google.com/speed/docs/insights/Server&quot;&gt;Improve Server Response Time&lt;/a&gt; (Google PageSpeed Insights documentation)&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://apogeewatcher.com/blog/network-performance-dns-tls-http-cdn-cache-rules&quot;&gt;Network Performance for Web Teams: DNS, TLS, HTTP, CDN, and Cache Rules&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://apogeewatcher.com/blog/wordpress-site-slow-not-always-hosting&quot;&gt;Why Your WordPress Site Is Slow (It Is Not Always Hosting)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://apogeewatcher.com/blog/woocommerce-performance-tuning-2026&quot;&gt;WooCommerce Performance Tuning (2026 Guide)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://apogeewatcher.com/blog/quick-way-to-fix-lcp&quot;&gt;A Quick Way to Fix LCP: Four Changes That Cut Time to Paint&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://apogeewatcher.com/blog/performance-budget-thresholds-template&quot;&gt;Performance Budget Thresholds Template&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://apogeewatcher.com/blog/pagespeed-insights-vs-automated-monitoring-when-manual-checks-arent-enough&quot;&gt;PageSpeed Insights versus automated monitoring&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://apogeewatcher.com/blog/lcp-inp-cls-what-each-core-web-vital-means-and-how-to-fix-it&quot;&gt;LCP, INP, and CLS explained&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/25143/ttfb-wont-go-down-server-side-culprits-beyond-the-theme</guid>
<pubDate>Sun, 23 Aug 2026 10:02:00 +0000</pubDate>
</item>
<item>
<title>Automation periodically tasks with CRON job scheduler</title>
<link>https://coderlegion.com/794/automation-periodically-tasks-with-cron-job-scheduler</link>
<description>&lt;p&gt;What is CRON? Unix-like operating systems provide utility for run periodical tasks. For example you need to run script every day at 08:00 AM. CRON read tasks from configuration file line by line and have special syntax.&lt;/p&gt;
&lt;p&gt;Windows have their own tool named as &quot;Windows Task Scheduler&quot;.&lt;/p&gt;
&lt;p&gt;Open terminal and run &quot;crontab -e&quot; command. When you open crontab first time, you must choose editor, which is convenient for your use. Enter number of preferred editor and press &quot;Enter&quot;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user@localhost:~$ crontab -e
no crontab for user - using an empty one

Select an editor.  To change later, run 'select-editor'.
  1. /bin/nano        &amp;lt;---- easiest
  2. /usr/bin/vim.tiny

Choose 1-2 [1]:
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When you open cron system display generated configuration file with description:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').
#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Structure of executable command:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# ┌───────────── minute (0–59)
# │ ┌───────────── hour (0–23)
# │ │ ┌───────────── day of the month (1–31)
# │ │ │ ┌───────────── month (1–12)
# │ │ │ │ ┌───────────── day of the week (0–6) (Sunday to Saturday;
# │ │ │ │ │                                   7 is also Sunday on some systems)
# │ │ │ │ │
# │ │ │ │ │
# * * * * * &amp;lt;command to execute&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here cheat-sheet of some examples:&lt;/p&gt;
&lt;p&gt;Run task every minute:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;* * * * * cd /home/user &amp;amp;&amp;amp; ./my_script.sh
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run task every 5 minutes:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;*/5 * * * * cd /home/user &amp;amp;&amp;amp; ./my_script.sh
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run task every 1 hour:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;0 * * * * cd /home/user &amp;amp;&amp;amp; ./my_script.sh
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or use &quot;@hourly&quot; definition.&lt;/p&gt;
&lt;p&gt;Run task every day at 00:00:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;0 0 * * * cd /home/user &amp;amp;&amp;amp; ./my_script.sh
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or use &quot;@daily&quot; definition.&lt;/p&gt;
&lt;p&gt;If your command not running by any reason use &quot;bash -c&quot;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;*/5 * * * * bash -c 'cd /home/user &amp;amp;&amp;amp; ./my_script.sh'
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run task at system startup:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;@reboot cd /home/user &amp;amp;&amp;amp; ./my_script.sh
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Save changes and exit from editor. Now we're need to reload CRON service. Its need for read configuration file again. Just use &quot;service cron reload&quot; command:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user@localhost:~$ service cron reload
Reloading configuration files for periodic command scheduler: cron.
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Cron Jobs</category>
<guid isPermaLink="true">https://coderlegion.com/794/automation-periodically-tasks-with-cron-job-scheduler</guid>
<pubDate>Mon, 13 Jan 2025 20:57:40 +0000</pubDate>
</item>
</channel>
</rss>