{"id":13343,"date":"2025-12-20T10:27:33","date_gmt":"2025-12-20T04:57:33","guid":{"rendered":"https:\/\/www.youstable.com\/blog\/?p=13343"},"modified":"2025-12-20T10:27:35","modified_gmt":"2025-12-20T04:57:35","slug":"how-to-setup-cron-jobs-on-linux-server","status":"publish","type":"post","link":"https:\/\/www.youstable.com\/blog\/how-to-setup-cron-jobs-on-linux-server","title":{"rendered":"How to Setup Cron Jobs on Linux Server &#8211; Easy Guide"},"content":{"rendered":"\n<p>To set up cron jobs on a Linux server, choose the right user, open their crontab with <code>crontab -e<\/code>, add a schedule (minute hour day month weekday) and a full-path command, save, then verify with <code>crontab -l<\/code>. Check logs (<code>\/var\/log\/cron<\/code> or <code>\/var\/log\/syslog<\/code>) and use absolute paths, environment variables, and <code>flock<\/code> to avoid overlaps.<\/p>\n\n\n\n<p>If you\u2019re learning how to setup cron jobs on Linux server environments, this guide gives you a practical, copy\u2011paste friendly walkthrough. As a long-time server admin and Senior Technical SEO <a href=\"https:\/\/www.youstable.com\/blog\/how-to-become-a-content-writer\/\">content writer<\/a> at YouStable, I\u2019ll show you the right syntax, real examples, troubleshooting tips, and best practices that actually work on production systems.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"what-is-cron-and-why-use-it\"><strong>What Is Cron and Why Use It?<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"2848\" height=\"1600\" src=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2025\/12\/image-79.png\" alt=\"What Is Cron and Why Use It?\" class=\"wp-image-13584\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2025\/12\/image-79.png 2848w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2025\/12\/image-79-150x84.png 150w\" sizes=\"auto, (max-width: 2848px) 100vw, 2848px\" \/><\/figure>\n\n\n\n<p>Cron is Linux\u2019s built-in task scheduler. It runs a background daemon (<code>cron<\/code>\/<code>crond<\/code>) that executes commands on a fixed schedule\u2014backups, log rotation, script automation, and more. You edit a \u201ccrontab\u201d (cron table) to define when and what should run.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"cron-vs-systemd-timers-vs-anacron\"><strong>Cron vs systemd Timers vs Anacron<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Cron: Precise schedules to the minute. Great for servers always online.<\/li>\n\n\n\n<li>systemd timers: Modern alternative with dependency control, on-boot delays, and better logging via <code>journalctl<\/code>.<\/li>\n\n\n\n<li>Anacron: Ensures daily\/weekly\/monthly jobs run even if the machine was off (common on laptops\/Ubuntu servers for <code>\/etc\/cron.daily<\/code>).<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"how-cron-works\"><strong>How Cron Works<\/strong><\/h3>\n\n\n\n<p>The cron daemon reads user crontabs and system cron files, checks schedules every minute, and executes due commands using a minimal environment. On Debian\/Ubuntu the service is <code>cron<\/code>; on RHEL\/CentOS\/Alma\/Rocky it\u2019s <code>crond<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"cron-job-basics-and-syntax\"><strong>Cron Job Basics and Syntax<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"crontab-time-fields\"><strong>Crontab Time Fields<\/strong><\/h3>\n\n\n\n<p>A user crontab line has five time fields followed by a command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u250c\u2500 minute (0\u201359)\n# \u2502 \u250c\u2500 hour (0\u201323)\n# \u2502 \u2502 \u250c\u2500 day of month (1\u201331)\n# \u2502 \u2502 \u2502 \u250c\u2500 month (1\u201312 or JAN\u2013DEC)\n# \u2502 \u2502 \u2502 \u2502 \u250c\u2500 day of week (0\u20137 or SUN\u2013SAT; 0\/7=Sunday)\n# \u2502 \u2502 \u2502 \u2502 \u2502\n# * * * * *  command-to-run<\/code><\/pre>\n\n\n\n<p>Use ranges (e.g., <code>1-5<\/code>), lists (<code>1,15,30<\/code>), and steps (<code>*\/5<\/code> for every 5 units). In system files like <code>\/etc\/crontab<\/code> and <code>\/etc\/cron.d\/*<\/code>, a sixth field (user) appears before the command.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"special-strings\"><strong>Special Strings<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>@reboot    \/path\/to\/script.sh\n@hourly    \/path\/to\/script.sh\n@daily     \/path\/to\/script.sh\n@weekly    \/path\/to\/script.sh\n@monthly   \/path\/to\/script.sh\n@yearly    \/path\/to\/script.sh\n@annually  \/path\/to\/script.sh<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"user-vs-system-crontabs\"><strong>User vs System Crontabs<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>User crontab: <code>crontab -e<\/code> (no user field; runs as that user)<\/li>\n\n\n\n<li>System crontab: <code>\/etc\/crontab<\/code> (includes a user field)<\/li>\n\n\n\n<li>Drop-in files: <code>\/etc\/cron.d\/<\/code> (one job per line, includes user)<\/li>\n\n\n\n<li>Periodic dirs: <code>\/etc\/cron.daily<\/code>, <code>weekly<\/code>, <code>monthly<\/code> run via <code>run-parts<\/code><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"environment-variables-in-cron\"><strong>Environment Variables in Cron<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>PATH<\/code>: Set a safe, explicit path.<\/li>\n\n\n\n<li><code>SHELL<\/code>: Default is <code>\/bin\/sh<\/code>; set to <code>\/bin\/bash<\/code> if you need Bash features.<\/li>\n\n\n\n<li><code>MAILTO<\/code>: Send output to an email; empty to suppress.<\/li>\n\n\n\n<li><code>CRON_TZ<\/code>: On many distros, sets timezone per crontab.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code># Example header in crontab\nSHELL=\/bin\/bash\nPATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin\nMAILTO=admin@example.com\n# CRON_TZ=UTC<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"step-by-step-setup-cron-jobs-on-linux-server\"><strong>Step-by-Step: Setup Cron Jobs on Linux Server<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"1-pick-the-right-account\"><strong>1) Pick the Right Account<\/strong><\/h3>\n\n\n\n<p>Run jobs under the least-privileged user that still has <a href=\"https:\/\/www.youstable.com\/blog\/access-file-manager-in-cpanel\/\">access to the files<\/a> and commands needed. Use <code>root<\/code> only when required (e.g., system backups, package tasks).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"2-open-your-crontab\"><strong>2) Open Your Crontab<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Edit the crontab for the current user\ncrontab -e\n\n# For another user (requires sudo)\nsudo crontab -u www-data -e<\/code><\/pre>\n\n\n\n<p>Select your editor on first run. If needed, set it explicitly:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export EDITOR=vim\ncrontab -e<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"3-add-a-job\"><strong>3) Add a Job<\/strong><\/h3>\n\n\n\n<p>Add a line with a schedule and a full-path command. Redirect stdout\/stderr to a log so you can debug.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Every 5 minutes\n*\/5 * * * * \/usr\/bin\/php \/var\/www\/app\/artisan schedule:run &gt;&gt; \/var\/log\/app-cron.log 2&gt;&amp;1\n\n# Run a backup at 02:30 daily\n30 2 * * * \/usr\/bin\/rsync -a --delete \/data\/ \/backups\/data\/ &gt;&gt; \/var\/log\/backup.log 2&gt;&amp;1\n\n# At reboot, start a worker (with a small delay)\n@reboot \/bin\/sleep 20 &amp;&amp; \/usr\/bin\/systemctl --user start queue-worker.service<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"4-save-and-verify\"><strong>4) Save and Verify<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># List current crontab\ncrontab -l\n\n# Validate cron service is running\n# Debian\/Ubuntu\nsystemctl status cron\n# RHEL\/CentOS\/Alma\/Rocky\nsystemctl status crond<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"5-test-and-check-logs\"><strong>5) Test and Check Logs<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Quick test: write timestamp every minute\n* * * * * \/usr\/bin\/date &gt;&gt; \/tmp\/cron-test.txt 2&gt;&amp;1<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Debian\/Ubuntu logs: <code>\/var\/log\/syslog<\/code> (search for CRON)<\/li>\n\n\n\n<li>RHEL family logs: <code>\/var\/log\/cron<\/code><\/li>\n\n\n\n<li>systemd journal: <code>journalctl -u cron<\/code> or <code>journalctl -u crond<\/code><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>grep CRON \/var\/log\/syslog\ntail -f \/var\/log\/cron\njournalctl -u cron -f<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"real-world-cron-examples-you-can-copy\"><strong>Real-World Cron Examples You Can Copy<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"avoid-overlaps-with-flock\"><strong>Avoid Overlaps with flock<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Every 10 minutes, run job if not already running\n*\/10 * * * * \/usr\/bin\/flock -n \/tmp\/report.lock \/usr\/local\/bin\/generate_report.sh &gt;&gt; \/var\/log\/report.log 2&gt;&amp;1<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"system-wide-cron-with-a-specific-user\"><strong>System-Wide Cron with a Specific User<\/strong><\/h3>\n\n\n\n<p>Use <code>\/etc\/cron.d\/<\/code> to specify the user field explicitly.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \/etc\/cron.d\/db-backup\nSHELL=\/bin\/bash\nPATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin\n\n# minute hour dom mon dow  <a href=\"https:\/\/www.youstable.com\/blog\/scp-command-in-linux\/\">user      command<\/a>\n15     3    *   *   *    postgres  \/usr\/bin\/pg_dump -Fc mydb | \/usr\/bin\/gzip -c &gt; \/backups\/mydb-$(date +\\%F).dump.gz 2&gt;&amp;1<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"cron-with-run-parts-daily-scripts\"><strong>Cron with run-parts (Daily Scripts)<\/strong><\/h3>\n\n\n\n<p>Drop executable scripts in <code>\/etc\/cron.daily\/<\/code>. Names must match <code>run-parts<\/code> rules (no dots).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \/etc\/cron.daily\/rotate-uploads (chmod +x)\n\/usr\/sbin\/tmpreaper 14d \/var\/www\/uploads<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"manage-list-disable-and-remove-cron-jobs\"><strong>Manage, List, Disable, and Remove Cron Jobs<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"list-and-remove\"><strong>List and Remove<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>crontab -l            # list\ncrontab -r            # remove current user's crontab\nsudo crontab -u user -l\nsudo crontab -u user -r<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"temporarily-disable-a-job\"><strong>Temporarily Disable a Job<\/strong><\/h3>\n\n\n\n<p>Comment it out and add context for future you:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># PAUSED 2025-02-01: heavy load during migration\n# *\/2 * * * * \/usr\/local\/bin\/indexer.sh &gt;&gt; \/var\/log\/indexer.log 2&gt;&amp;1<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"one-off-timed-tasks\"><strong>One-Off Timed Tasks<\/strong><\/h3>\n\n\n\n<p>Use at or systemd-run &#8211;on-active for one-time <a href=\"https:\/\/www.youstable.com\/blog\/install-cron-jobs-on-linux\/\">jobs instead of cron:<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"\/usr\/local\/bin\/once.sh\" | at 02:00\nsystemd-run --on-active=5m \/usr\/local\/bin\/cache-warm.sh<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"troubleshooting-cron-jobs\"><strong>Troubleshooting Cron Jobs<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"check-logs-and-command-output\"><strong>Check Logs and Command Output<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Redirect output to a file: <code>&gt;&gt; \/var\/log\/myjob.log 2&gt;&amp;1<\/code><\/li>\n\n\n\n<li>Watch the service journal: <code>journalctl -u cron -f<\/code> or <code>journalctl -u crond -f<\/code><\/li>\n\n\n\n<li>Ensure the job file loads (correct file name under <code>\/etc\/cron.d<\/code>, no dots)<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"fix-environment-differences\"><strong>Fix Environment Differences<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Set <code>PATH<\/code> explicitly; cron has a minimal environment.<\/li>\n\n\n\n<li>Use full paths to binaries (<code>\/usr\/bin\/python3<\/code>, <code>\/usr\/bin\/php<\/code>).<\/li>\n\n\n\n<li>Source virtualenvs or profiles inside scripts if needed.<\/li>\n\n\n\n<li>Use <code>SHELL=\/bin\/bash<\/code> if you rely on Bash features.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"permissions-and-allow-deny\"><strong>Permissions and Allow\/Deny<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>\/etc\/cron.allow<\/code>: Whitelist users allowed to use cron.<\/li>\n\n\n\n<li><code>\/etc\/cron.deny<\/code>: Blacklist users.<\/li>\n\n\n\n<li>Ensure executable and readable scripts; correct ownership for target files\/dirs.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"cron-not-running\"><strong>Cron Not Running?<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Service status: <code>systemctl status cron<\/code> or <code>systemctl status crond<\/code><\/li>\n\n\n\n<li>Enable on boot: <code>systemctl enable cron<\/code> or <code>systemctl enable crond<\/code><\/li>\n\n\n\n<li>SELinux\/AppArmor may block actions\u2014check audit logs.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"security-and-best-practices\"><strong>Security and Best Practices<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use absolute paths everywhere.<\/li>\n\n\n\n<li>Quote variables and paths; avoid word-splitting bugs.<\/li>\n\n\n\n<li>Least privilege: run under a non-root user when possible.<\/li>\n\n\n\n<li>Prevent overlaps with <code>flock<\/code> or PID files.<\/li>\n\n\n\n<li>Log outputs and rotate logs. Integrate with monitoring.<\/li>\n\n\n\n<li>Keep secrets in environment files or a vault, not inline.<\/li>\n\n\n\n<li>Wrap complex commands in version-controlled scripts.<\/li>\n\n\n\n<li>Validate backups with test restores; schedule integrity checks.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"cron-on-popular-distros-quick-notes\"><strong>Cron on Popular Distros (Quick Notes)<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Debian\/Ubuntu: Service is <code>cron<\/code>; logs in <code>\/var\/log\/syslog<\/code>. <code>\/etc\/cron.daily<\/code> often driven by Anacron on servers.<\/li>\n\n\n\n<li>RHEL\/CentOS\/Alma\/Rocky: Service is <code>crond<\/code>; logs in <code>\/var\/log\/cron<\/code>. Package is usually <code>cronie<\/code>.<\/li>\n\n\n\n<li>SUSE\/OpenSUSE: Similar to RHEL; verify with <code>systemctl status cron<\/code>.<\/li>\n\n\n\n<li>Containers: Consider a single supervisor (e.g., <code>supervisord<\/code>) or external schedulers; cron inside containers is possible but design carefully.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"key-takeaways\"><strong>Key Takeaways<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Edit with <code>crontab -e<\/code>, verify with <code>crontab -l<\/code>, and monitor logs.<\/li>\n\n\n\n<li>Use explicit paths, environment variables, and <code>flock<\/code> to avoid overlaps.<\/li>\n\n\n\n<li>Choose the right mechanism: cron, systemd timers, or Anacron.<\/li>\n\n\n\n<li>Harden security with least privilege and audited scripts.<\/li>\n\n\n\n<li>For peace of mind, consider YouStable\u2019s managed servers to set up and monitor critical schedules.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"faqs-cron-jobs-on-linux-server\"><strong>FAQs: Cron Jobs on Linux Server<\/strong><\/h2>\n\n\n<div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-1765800171246\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"what-is-the-correct-cron-syntax-for-every-5-minutes\"><strong>What is the correct cron syntax for every 5 minutes?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Use <code>*\/5 * * * *<\/code> followed by your command. Example: <code>*\/5 * * * * \/usr\/bin\/php \/var\/www\/app\/artisan schedule:run &gt;&gt; \/var\/log\/app-cron.log 2&gt;&amp;1<\/code>.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765800176627\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"why-does-my-script-work-in-the-shell-but-not-in-cron\"><strong>Why does my script work in the shell but not in cron?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Cron has a minimal environment. Set PATH, use full binary paths, specify SHELL=\/bin\/bash if using Bash features, source venvs, and <a href=\"https:\/\/www.youstable.com\/blog\/fix-the-error-too-many-redirects\/\">redirect output to a log to capture errors<\/a>.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765800186275\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"where-can-i-find-cron-logs-on-linux\"><strong>Where can I find cron logs on Linux?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>On Debian\/Ubuntu, check <code>\/var\/log\/syslog<\/code> for CRON entries. On RHEL\/CentOS\/Alma\/Rocky, check <code>\/var\/log\/cron<\/code>. Also review <code>journalctl -u cron<\/code> or <code>journalctl -u crond<\/code>.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765800194991\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"how-do-i-set-a-different-timezone-for-a-cron-job\"><strong>How do I set a different timezone for a cron job?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Many distros support <code>CRON_TZ<\/code> per crontab. Example: <code>CRON_TZ=UTC<\/code> on the first line. Otherwise, set the system timezone or handle timezones inside your script.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765800202458\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"how-can-i-run-a-cron-job-as-root-or-another-user\"><strong>How can I run a cron job as root or another user?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Use <code>sudo crontab -e<\/code> to edit root\u2019s crontab. Or create a file in <code>\/etc\/cron.d\/<\/code> and include the username field. Ensure <code>\/etc\/cron.allow<\/code>\/<code>deny<\/code> permit that user.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>To set up cron jobs on a Linux server, choose the right user, open their crontab with crontab -e, add [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":15484,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"iawp_total_views":5,"footnotes":""},"categories":[350],"tags":[],"class_list":["post-13343","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-knowledgebase"],"acf":[],"featured_image_src":"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2025\/12\/How-to-Setup-Cron-Jobs-on-Linux-Server.jpg","author_info":{"display_name":"Prahlad Prajapati","author_link":"https:\/\/www.youstable.com\/blog\/author\/prahladblog"},"_links":{"self":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/13343","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/comments?post=13343"}],"version-history":[{"count":4,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/13343\/revisions"}],"predecessor-version":[{"id":13585,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/13343\/revisions\/13585"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/media\/15484"}],"wp:attachment":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/media?parent=13343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/categories?post=13343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/tags?post=13343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}