Knowledgebase

The try-later Script  Print this Article

Overview:

The /usr/local/cpanel/scripts/try-later script runs a check command at a specified interval. If the check command returns an error, the script will retry that check command a specified number of times. When the check command succeeds, the script will run the action command. If the check command fails the maximum number of retries, the script will perform an act-finally command.

Run the script

To run this script on the command line, use the following format:

/usr/local/cpanel/3rdparty/bin/perl /usr/local/cpanel/scripts/try-later --action COMMAND -x --max-retries NUMBEROFRETRIES --delay NUMBEROFMINUTES --check COMMAND -c exit 1 --at now + 1 minute --act-finally 0

Options

Use the following options with this script:

Options Description Example
--check COMMAND The script runs this command to determine whether to perform the action command. /usr/local/cpanel/scripts/try-later --check COMMAND
--at The script will run the check command at the specified time. For more information, read the at manual page. /usr/local/cpanel/scripts/try-later --at 1620 apr 20
--delay The script will pause for this number of minutes before it performs each check and action command.
Note:
This option overrides the --at option.
/usr/local/cpanel/scripts/try-later --delay 5
--max-retries The script will attempt to run the check command this number of times. /usr/local/cpanel/scripts/try-later --max-retries 3
--skip-check The script will skip the first check command. /usr/local/cpanel/scripts/try-later --skip-check
--action COMMAND When the check command succeeds, the script will run the action command. /usr/local/cpanel/scripts/try-later --action COMMAND
--act-finally COMMAND If the check command fails the maximum number of retries, the script performs this command. /usr/local/cpanel/scripts/try-later --act-finally COMMAND
--has-jobs The script will indicate whether its queue is empty or not. /usr/local/cpanel/scripts/try-later --has-jobs

Was this answer helpful?

Related Articles

WHM Scripts
Overview: The cPanel & WHM installation process adds important scripts to your server’s...
The dbmaptool Script
Overview: You can use the /usr/local/cpanel/bin/dbmaptool script to grant ownership of databases...
The servers_queue Script
Overview: This script allows you to manage the task queue system. The task queue system allows...
The auto-adjust-mysql-limits Script
Overview: The /usr/local/cpanel/scripts/auto-adjust-mysql-limits script updates MySQL®...
The autossl_check Script
Overview: The /usr/local/cpanel/bin/autossl_check script allows you to manually check the SSL...