Direct Cron Token : The Advanced Option – (Pro Plugin Only)

What is Direct Cron Token system?

The Direct Cron Token system is provided to trigger the Reset Process in situations where the Reset Runner URL and Reset Runner REST URL systems are not capable of doing so. The Direct Cron Token system utilizes the Unix Cron feature of the server where your WordPress website is hosted to trigger the Reset Process by directly calling a PHP file. Therefore, it experiences minimal interference from server-side firewalls, security plugins, firewall plugins, and CDN security features. However, to set up the Direct Cron Token system, you may need to have basic knowledge about cPanel, Unix Cron, File Manager, and/or FTP access to the server root directory. Also your server must be a Unix-like operating system, such as Linux. If you follow the step-by-step guide, setting it up will be very easy. The following descriptions primarily align with hosting solutions that provide cPanel.

Note: Demo Reset Direct Cron V1 will not receive updates via the WordPress Plugins page, because an in-dashboard update would overwrite the hard-coded token and may interrupt reset execution. Instead, new releases will be published on this page as V1, V2, V3, and so on. To update, you must manually download the latest version, upload it to your website, activate it, and then follow the setup instructions below.

➤ Step 1 – Download the Demo Reset Direct Cron V1 addon plugin zip file, upload it to your WordPress website and activate the plugin.

Version 1 download link: Demo Reset Direct Cron V1 plugin zip

➤ Step 2 – Generate the unique Direct Cron Token. As a prerequisite to generating a Direct Cron Token, you must install and activate the Demo Reset Direct Cron V1 plugin.

➤ Step 3 – Go to cPanel > File Manager and open the demo-reset-direct-cron-v1/cron/demo-reset-direct-cron-runner.php file in the File Manager’s text editor or via FTP. It is located inside the cron folder of the Demo Reset Direct Cron V1 plugin.

➤ Step 4 – Now, copy the Direct Cron Token from the Reset Runners page and paste it inside the single quotes in code line 14, then save it.

➜ This is how the code line 14 looks by default:
if ($corn_token !== 'PasteDirectCronTokenHere') exit;

➤ Step 5 – To enhance security, re-name the cron directory via File Manager or FTP by adding a random prefix that includes lowercase English letters, numbers, and a dash (-).

➜ As an example: Here is how it should look after renaming:
w1rh5yxc8a-cron
➜ As an example: Here is how the file path should look after renaming:
demo-reset-direct-cron-v1/w1rh5yxc8a-cron/demo-reset-direct-cron-runner.php

➤ Step 6 – Access your server’s Cron Jobs functionality by navigating to your server’s cPanel > Cron Jobs.

➤ Step 7 – Choose the frequency at which you need to run the cron command. The ideal cron schedule for resetting Demo Websites is Once Per Day or Twice Per Day, unless there is high traffic.

➤ Step 8 – Now, you have to build your cron command part by part.

➜ The parts of the cron command in order:
[PHP Executable Path][space][Absolute Path to demo-reset-direct-cron-runner.php file][space][Direct Cron Token]

➜ Example Command:
/usr/local/bin/php /home2/xxxxxx/public_html/yourwebsite/wp-content/plugins/demo-reset-direct-cron-v1/w1rh5yxc8a-cron/demo-reset-direct-cron-runner.php xxxxxxxxxxxxxxxxxxxx

● Step 8.1 – Finding the PHP Executable Path

➜ Option 1 - Finding the PHP Executable Path in cPanel's Cron Jobs feature:

To obtain the PHP Executable Path; access your server's cPanel > Cron Jobs.

On the Cron Jobs page, under the "Add New Cron Job" section, you will see examples of both the general PHP Executable Path and the domain-specific PHP Executable Path.

"General PHP Executable Path" refers to: The path where PHP is installed for global use across the system. It will look something like: /usr/local/bin/php

"Domain-specific PHP Executable Path" refers to: The path where a specific PHP version is installed for domain-specific use within the system. It will look something like: /usr/local/bin/ea-php99

The "ea-php99" part should be replaced with the PHP version assigned to the domain you wish to use for the Demo Website.
The domain-specific PHP version can be found in cPanel's MultiPHP Manager feature.

Please copy and save the General PHP Executable Path or create the Domain-specific PHP Executable Path for the domain you wish to use for the Demo Website.

Note: For non-cPanel hosts or basic VPS/dedicated servers, the typical general PHP Executable Path is /usr/bin/php.

➜ Option 2 - Obtain the PHP Executable Path by contacting your hosting provider:

Every commercial hosting provider has a customer support system in place.

You can contact them directly through customer support and ask for the General PHP Executable Path or Domain-specific PHP Executable Path on your server.

● Step 8.2 – Finding the Absolute Path to the demo-reset-direct-cron-runner.php file

➜ Option 1 - Retrieve the Absolute Path using cPanel's File Manager feature:

To obtain the Absolute Path to the demo-reset-direct-cron-runner.php file; access your server's cPanel > File Manager.

Then navigate to the wp-content/plugins/demo-reset-direct-cron-v1/w1rh5yxc8a-cron/demo-reset-direct-cron-runner.php file which is located inside the re-named cron folder of the Demo Reset Direct Cron V1 plugin.

Open that file in the File Manager's text editor same as in Step 3. Now, you can see the Absolute Path of the demo-reset-direct-cron-runner.php file in the top bar of the File Manager's text editor.

Please copy and save that Absolute File Path in a text file; you will need it to build the Unix Cron command.

➜ Option 2 - Build the Absolute Path using cPanel's FTP Accounts feature:

To obtain the Absolute Path of the Home directory of the server; access your server's cPanel > FTP Accounts.

On the FTP Accounts page, under the "Add FTP Account" section, you will see the Absolute Path of the Home directory, which will look something like /home/username/.

You can now build the Absolute Path of the demo-reset-direct-cron-runner.php file by following the directory structure from the Home directory to the demo-reset-direct-cron-runner.php file.

It will look something like /home2/xxxxxx/public_html/yourwebsite/wp-content/plugins/demo-reset-direct-cron-v1/w1rh5yxc8a-cron/demo-reset-direct-cron-runner.php.

➜ Option 3 - Obtain the Absolute Path by contacting your hosting provider:

Every commercial hosting provider has a customer support system in place.

You can contact them directly through customer support and ask for the Absolute Path of the demo-reset-direct-cron-runner.php file.

● Step 8.3 – Build the cron command by assembling its parts in the order of:

[PHP Executable Path][space][Absolute Path to demo-reset-direct-cron-runner.php file][space][Direct Cron Token]

This will become your real Unix Cron command. Also, make sure all three components of the command are separated by a single white space.

➤ Step 9 – Paste the newly created Unix Cron command in the command field and save the Cron Job.

➤ Congratulations! You have just set up the Direct Cron Token Reset Runner system for your Demo Website.

➤ If you re-generate the Direct Cron Token on the website, you will need to update it in the demo-reset-direct-cron-runner.php file and in the Unix Cron command, to trigger the Website Reset without any problem.

➤ Note: The above descriptions primarily align with hosting solutions that provide cPanel.
For non-cPanel hosting solutions, you may need to consult their documentation to determine the PHP Executable Path, Absolute Path, and instructions for setting up Cron Jobs.