Home Uncategorized

Cron Jobs: $((RANDOM % 60)) - What is it?

Last updated on Jul 30, 2025

Cron Jobs: sleep $((RANDOM % 60)) && – What Is It?

Description

If you’ve noticed that your cron jobs suddenly start with sleep $((RANDOM % 60)); and wondered why—this article explains everything. Brixly now automatically prefixes every user cron with this snippet on all shared hosting servers. If you remove it, the server will add it back automatically.

This random delay (up to 60 seconds) is essential for maintaining optimal server performance and a smooth experience for all users.


Why Does My Cron Job Start With sleep $((RANDOM % 60)) &&?

You might see something like this in your cPanel Cron Jobs interface or your crontab:

sleep $((RANDOM % 60)) &&; /usr/bin/php /home/username/public_html/script.php

What does this do?

  • sleep $((RANDOM % 60)) &&; – This command causes your cron job to wait for a random number of seconds (between 0 and 59) before running the main command.

  • Purpose: This prevents all users' cron jobs from running at the exact same second, which can cause server load spikes and slow performance.


Example

If you set a cron job to run every minute:

* * * * * /usr/bin/php /home/username/public_html/script.php

It will automatically become:

* * * * * sleep $((RANDOM % 60)) && /usr/bin/php /home/username/public_html/script.php

Frequently Asked Questions

> I’m seeing crons with sleep $((RANDOM % 60)) && added at the start, but I didn’t do this?

The server automatically adds a random delay of up to 60 seconds before a cron is run. This stops every user’s crons running at the exact same second, causing CPU spikes and slowing down the server. It helps keep everything running efficiently and smoothly for every user on the server.

This will not interfere with the functionality of your cron and it can’t be removed; it’s required for all crons to have this in order to provide everyone with the best possible experience.


How Does This Affect My Cron Jobs?

  • Functionality: Your scripts will run as normal, just with a random delay of up to 60 seconds.

  • Reliability: There is no negative impact on how your scripts execute.

  • Cannot Remove: Attempting to remove this prefix will have no effect; the server will automatically restore it.


Managing Cron Jobs in cPanel

You can manage your cron jobs using the Cron Jobs tool in cPanel:

  1. Log in to cPanel.

  2. Go to Advanced > Cron Jobs.

  3. Add or edit your cron as needed. The system will automatically prepend the random sleep command.

**Note:**There is no option to disable or bypass this feature.


Troubleshooting

My Cron Job Is Not Running as Expected

  • Check for script errors. The random delay should not affect your script’s outcome.

  • Review cron output. If your command is not running, ensure the actual command (after &&) is correct.

  • Timing: Remember there may be up to a 60-second delay from the scheduled run time.

How Can I Verify My Cron Is Running?

  • Add output to a file for debugging:

    sleep $((RANDOM % 60)) &&; /usr/bin/php /home/username/public_html/script.php >> /home/username/cron.log 2>&1
    
  • Check cron.log in your home directory to verify execution.


Summary

  • All user cron jobs are automatically prefixed with sleep $((RANDOM % 60)) &&.

  • This is required and cannot be removed.

  • It helps distribute cron executions, preventing load spikes and ensuring efficient server performance.

  • There is no impact on your script’s functionality—just a random delay before execution.

  • Manage your cron jobs via cPanel as usual.

If you have further questions or issues with your cron jobs, please submit a support ticket so our team can assist you.