Creating CRON Job
« on: February 28, 2021, 10:25:48 AM »
Hi. I am very new to Plesk and PHP. I was trying to set up a CRON job so that the code can run at least once every 3 days. I try all different configurations but it all doesn't work. I try to search for all previous posts and try every single one of them and non of them work. What is the step to get started to configure the CRON job?

I tried this command, with a space:
/usr/bin/php /var/www/vhosts/website_Name/generator/runcrawl.php
I get the error: /bin/sh: /usr/bin/php: No such file or directory (But where to create this folder because I am using Plesk)

Re: Creating CRON Job
« Reply #1 on: February 28, 2021, 06:21:46 PM »

please try to change it to:
/usr/local/bin/php /var/www/vhosts/website_Name/generator/runcrawl.php

or just:
php /var/www/vhosts/website_Name/generator/runcrawl.php
Re: Creating CRON Job
« Reply #2 on: March 02, 2021, 03:13:29 PM »

I tried the first link and still the same message that the directory does not exist.
I try the one with just PHP and got this error:

/bin/sh: php: command not found

I also tried to put as: /php /var/www/vhosts/website_Name/generator/runcrawl.php
And getting the same error as the directory does not exist.
Re: Creating CRON Job
« Reply #4 on: March 04, 2021, 03:16:35 AM »
Thanks for the link. I followed the instructions there to execute the file. I used the Run PHP Script this time with no parameter and after the code runs for quite some time, then I saw the message that the script completed but when I view the Crawl sitemap page, the code seems to stop halfway and I still need to retrigger the page. Anyway, I think it should be working now. Thanks.
Re: Creating CRON Job
« Reply #5 on: March 07, 2021, 07:58:02 AM »

I think the CRON Job is working already. But I notice that every time I will get this message that I need to manually continue that tasks. When I continue, then in the history, it will show only 1 link is updated. Anything that I need to configure?

Updated on 2021-03-05 20:30:03, Time elapsed: 2:30:01,
Pages crawled: 19893 (19704 added in sitemap), Queued: 11, Depth level: 103
Current page: agents/details/4752 (1.6)
Re: Creating CRON Job
« Reply #6 on: March 10, 2021, 10:43:47 AM »

it looks like your server configuration doesn't allow to run the script long enough to create full sitemap. Please try to increase memory_limit and max_execution_time settings in php configuration at your host (php.ini file) or contact hosting support regarding this.