Code

Discussion on Web Cronjobs

Discussion on Web Cronjobs

Cart 398 sales
Recently Updated

forza020 supports this item

Supported

This author's response time can be up to 1 business day.

166 comments found.

I need very precise instructions on how to perform an update!

I copied everything from the /protected/config folder to the server, except for db.php and mailer.php.

When I click on Categories or Cron Jobs, I get the message: Unknown Property An internal server error occurred. The above error occurred while the web server was processing your request.

I’ve now reverted to the previous version and am waiting for detailed instructions on how to update.

Hello,

The link to the change log is on the product’s page, as always.

https://docs.php8developer.com/web-cronjobs/#/changelog?id=v-112


Download the latest version of the script from CodeCanyon (redo it, since I uploaded a quick fix afterward) and follow all the instructions.

Regards,
Roman

Hi, why not integrate Google Authenticator verification into your login?

Hi. Google RECAPTCHA does its job perfectly.

why don’t you integrate it into the login to this scripts?

Sorry, I mistakenly read the script name. The “webcron jobs” script is used as an internal tool, meaning it can run arbitrary commands on your server.

The integration of third-party authentication mechanisms can pose a significant security vulnerability.

Having an internal tool, you should always consider additional security measures like adding an HTTP Basic Auth with a strong password, or/and by adding firewall/web server rules to whitelist an IP range that can open the script in a browser.

my site is not working, it was working fine, but then after a long time, and then it stop. Or is it mandatory to do an update for it to continue working?

Hello. Could you send me the error log file by email? You can find it here: ~root/protected/runtime/app.log

Hi, thanks a lot for replying. The issue was on the server side, which caused the cron job execution process to fail. But I was able to fix the issue, and now everything is working fine.

Hİ. Does this cronjob script have REST API feature like cron-job.org?

Hi. No, it doesn’t.

is cpanel needed? i dont have any panel. shared hosting. no ssh access

Hi. There is no real need for a panel unless you do not have a web server that can run PHP scripts, a database to store data, and a cron manager (such as crontab on Linux or Task Scheduler on Windows) to set up a periodic, every-minute task. Additionally, an optional mail server may be required to send notifications.

can 1 second work?

No, the minimal interval is one minute.

I want to delete log entries (statistics) that are older than a week. Where can I set this up? I have log entries that go back to November 2024!

I have now created a php file that I can call with Cronjob. Here is an example where logs that are older than 2 days are deleted. In the upper part, the correct path is determined, which then has to be inserted into the same file clear_logs.php in line 8 so that it runs smoothly. <?php // Datei: clear_logs.php $path = __DIR__ ; echo 'Change line 8 in clear_logs.php to : <b>chdir(\''. $path . '/protected\');</b><br />'; // Set the working directory correctly chdir('Enter the determined path here'); // Define the full path to the PHP execution and the yii file $command = '/usr/bin/php '. $path . '/protected/yii log/clear "-2 days" 2>&1'; // Create variables for the output and return value $output = []; $return_var = 0; // Run the command exec($command, $output, $return_var); // Output of the command (useful for debugging purposes) echo "<br />"; echo "command executed: $command<br />"; echo "output:<br />" . implode("<br />", $output) . "<br />"; echo "return value: $return_var<br />"; // Check if the command was successful if ($return_var === 0) { echo "The command was executed successfully. Logs older than 2 days were deleted.<br />"; } else { echo "There was an error executing the command. Please check the details.<br />"; } // Check if the output is empty if (empty($output)) { echo "No specific output was obtained from the command. The command may have succeeded without any console output.<br />"; } ?> You can also find the code here: https://pastebin.kumhofer.at/log-eintrage-loschen

Hold on, you are going in the wrong direction. Forget everything ChatGPT produced for you.

You already have a nice cron job manager, why don’t you leverage from it? Go to the Dashboard -> Create a new “Shell Command”. In the command field enter:
/usr/bin/php /path/to/script/protected/yii log/clear "-2 days" 
Replace:
- ”/usr/bin/php” with the PHP binary path.
- ”/path/to/script” with the path, where the script is installed.

Click save and manually run the task from the dashboard. If you make a mistake in the paths above, you will see an error output that clearly states what is wrong. If everything is fine, then you should not see the old logs.

This is the most complete and functional script I have ever purchased. I really commend you. I translated it into my language, and now it’s perfect. The only suggestion for new features would be the management of multiple users and two-factor authentication with Google Authenticator.

Hello,

Thank you for the kind review!

You can manage users via the CLI: https://docs.php8developer.com/web-cronjobs/#/user_management

Speaking about 2 factors auth, this script is intended for internal usage, so I believe it’s just fine to set up an HTTP Basic Auth or create a whitelist of IPs who can access the script. Both of these can be easily configured with nginx and Apache2.

Regards,
Roman

hello,

do we have any possible option to add less than a minute jobs, we have requirement of 2 secs for our customers..

in master job we can try to include it via sleep, so this will help on users jobs with 2 sec?

Hello,

There is no built-in solution to run a job every 2 seconds. The minimal interval is 1 minute, however, you can write a shell script that executes a binary every two seconds and terminates after a minute has passed.

#!/bin/bash
BINARY="./your_binary_name" 
START_TIME=$(date +%s)

while true; do
    # Run the binary
    $BINARY

    CURRENT_TIME=$(date +%s)
    ELAPSED_TIME=$((CURRENT_TIME - START_TIME))
    if [ $ELAPSED_TIME -ge 60 ]; then
        break
    fi

    sleep 2
done

Now you can create a shell task and set it to run every minute.

Thanks for your quick response any options for UI option so that users can select their own time below 1 minute like 2 or 5 sec

Unfortunately, there is no such built-in solution.

Pre-Sale: all of the servers I run use Plesk vs cPanel, will this app run on Plesk? I have an app called Perfex on one of my servers that has it’s own cron job. In addition, I have a multi-tenant module added which also has its cron. For reasons we can’t seem to determine the cron jobs stop returning errors that the cron hasn’t run in 24 hrs. If I set this up on another server am I able to run those cron jobs from this tool or am i simply monitoring the jobs that exist on the other servers? Seeing as how other apps have separate cron jobs, the hope would be to add & monitor all cron jobs from this tool. Any responses appreciated.

Hello. It runs everywhere, but you need to make sure that:

1. It meets the PHP minimum requirements. Download the script from here and run it on your server to find out that. https://docs.php8developer.com/web-cronjobs/#/installation?id=before-start

2. Make sure you can set up an every-minute cron job. This is a master cron that runs all the tasks you set via the dashboard. https://docs.php8developer.com/web-cronjobs/#/installation?id=native


Q: “If I set this up on another server am I able to run those cron jobs from this tool or am i simply monitoring the jobs that exist on the other servers?”

A: You can set only HTTP cross-server tasks (a task, that can be triggered only by sending an HTTP request to a specific URL). There is no way to call an internal binary on the remote server.

Regards, Roman

If there are many cron jobs in the list, you can no longer see the right part where you can edit the entry. I made the window completely large and have to scroll down first so that I can then scroll to the right to reach the editing buttons. If it was the top entry, I have to scroll back up again.

I think the fastest solution would be to make the 1st (ID) column sticky. I’ll try to implement that in the next update.

Do you have a solution for this, please? The first column containing the URL really doesn’t have to be that wide

I’ll try to find the best UX solution for this case and implement it in the next update.

I would like to propose a few useful and straightforward features for implementation.

In our system, we use about 150 tasks, some of which periodically need to be enabled and disabled, both individually and in groups.

1. Enable the ability to disable an entire group at once. So that when a group is disabled, the tasks themselves remain in the ENABLED state, but if they belong to a disabled group, they are considered disabled and no longer run.

2. Temporary disabling of a task and/or group. So that when disabling a task/group, you can (optionally) specify until what time it is disabled, and when that time comes, the task/group is automatically re-enabled.

These seem like simple implementations, but they would greatly simplify and add convenience in managing tasks.

Hi. Your proposed feature seems useful in many scenarios. I’ll add this to my TODO list; however, I don’t think I can complete it until February.

Hello, I’m working on an update, and I would like to ask a clarification question – your 2nd clause.

Currently, you can disable/enable a task (not a group) by setting “Start run at” which means that the task will start running only at the specified time (it’s enabled but not running until the specified time – like virtual disabling), and by setting either “Stop run at” or “Stop after N iterations” (the “Terminate” tab), which will disable a task when the condition is met.

So, do I miss something?

P.S. Auto group enabling/disabling is a practical feature, and I’ll definitely implement it.

Regards

The favicon is not displayed

The favicon path is ~root/favicon.ico. If it’s not visible with your browser theme, you can replace this file with your favicon (make sure it has a .ico extension).

In which file can I find the html header so that I can insert something into the head area?

The main layout is `~root\protected\views\layouts\main.php`

I get the following error message: Error An internal server error occurred. The above error occurred while the Web server was processing your request.

Just curious what did you set in the php.ini?

short_open_tag Default Value: On

Yes, short_open_tag directive should be enabled.

I added 2 users on 1 server. Then if I install this program for each user, will it work? And do I have to specify the path of each user in the code below?
  • * * * * /usr/bin/php /path/to/web/root/protected/yii exec >/dev/null 2>&1

Hi. No, you don’t need to do that. The master cron runs all the jobs for all users.

can be running with xampp in localhost?

Hello. Yes, you can.

Saas Model or Register a new user?

This script is used for personal usage, however, there is a possibility to create a new user via CLI, but the newly created user will utilize all the resources without any limitations.

https://docs.php8developer.com/web-cronjobs/#/user_management

Can I use this code just to “ping” some IP addresses only, and see if they answer, also where there is not a web server / web site? If Yes I will buy the script.

OK, let’s arrange the things. The script supports two types of tasks: HTTP and CLI.

To send an HTTP request PHP uses curl, however, since you say there is no web server this way doesn’t work.

On the other hand, a CLI command can run as a sub process forked by PHP. The most popular ping command is “ping”. So, to make this work make sure that:

1. The remote server which you want to ping supports the ICMP protocol by running the following command (0 means enabled)
cat /proc/sys/net/ipv4/icmp_echo_ignore_all
2. Your local server meets all the requirements. You can download the PHP script and run it in your browser to see the summary. https://webcron.php8developer.com/requirements.php (Copy-paste the link in a new browser tab since it can be blocked).

3. Make sure the “ping” command is installed and available by the PHP process.

thank you .. I forgot to tell that these are all Windows PCs

You can also enable ICMP on the remote Windows PC. Read this guide: https://hammer-software.com/how-to-enable-icmp-ping-through-the-windows-firewall-with-advanced-security-using-group-policy/

Once you do this, you can open the cmd (command prompt) on your local Windows PC and run “ping xxx” (replace xxx with the IP of the remote PC). If you see the response, then PHP also would see this.

by
by
by
by
by
by

Tell us what you think!

We'd like to ask you a few questions to help improve CodeCanyon.

Sure, take me to the survey