SowWun Posted September 11, 2017 Report Posted September 11, 2017 Hi, I'm having a little trouble running my cronjob via scheduled tasks in Plesk I am running Blesta 4.0.1 This is my scheduled task list /usr/bin/php /var/www/vhosts/****.com/httpdocs/clients/index.php cron I set it at every 5 minutes, everyday, every week/month, but it doesnt seem to run :(, anyone else have a prob like mine? Quote
0 Beav Posted September 11, 2017 Report Posted September 11, 2017 20 minutes ago, SowWun said: Hi, I'm having a little trouble running my cronjob via scheduled tasks in Plesk I am running Blesta 4.0.1 This is my scheduled task list /usr/bin/php /var/www/vhosts/****.com/httpdocs/clients/index.php cron I set it at every 5 minutes, everyday, every week/month, but it doesnt seem to run :(, anyone else have a prob like mine? Im not sure about plesk but with cpanel you have to change it to /usr/local/bin/php /var/www/vhosts/***.com/httpdocs/clients/index.php cron >/dev/null 2>&1 try this. Worth a try im sorry if I couldn't be helpful Quote
0 SowWun Posted September 11, 2017 Author Report Posted September 11, 2017 After checking, /usr/bin/php /var/www/vhosts/****.com/httpdocs/clients/index.php cron is indeed correct, however i get this error PHP Parse error: syntax error, unexpected '[' in /var/www/vhosts/****.com/httpdocs/clients/config/services.php on line 3 Quote
0 Nelsa Posted September 11, 2017 Report Posted September 11, 2017 You can set cron to https://****.com/clients/cron/?cron_key=your-cron-key And check "fetch URL" Change your-cron-key to key you can find in settings-->system-->automation-->update cron key SowWun 1 Quote
0 SowWun Posted September 11, 2017 Author Report Posted September 11, 2017 Thanks ! My plesk is the webadmin edition, I dont see a fetch URL button, but instead i used this command : curl -k https://***.com/clients/cron/?cron_key=DEARR7nW It seems to go okay ( No error log message ), but instead, I get this message : Quote % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 Quote
0 SowWun Posted September 11, 2017 Author Report Posted September 11, 2017 I cant edit the post, but an update ~ I ran this command wget --no-check-certificate https://****.com/clients/cron/?cron_key=DEARR7nW And I got this as a log file : Quote --2017-09-11 07:50:01-- https://****.com/clients/cron/?cron_key=DEARR7nW Resolving ****.com... ****.61 Connecting to ****.com|1****.61|:443... connected. WARNING: cannot verify hostkoala.com’s certificate, issued by “/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Domain Validation Secure Server CA”: Unable to locally verify the issuer’s authority. HTTP request sent, awaiting response... 302 Moved Temporarily Location: https://****.com/clients/ [following] --2017-09-11 07:50:02-- https://****.com/clients/ Reusing existing connection to ****.com:443. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/html] Saving to: “index.html?cron_key=DEARR7nW.1” But I dont think it ran as I cant see any logs from activity log from Blesta interface tho Quote
0 Nelsa Posted September 11, 2017 Report Posted September 11, 2017 If there is no fetch URL than jzst put GET in front..and it will work...I didn't know that plesk web edition doesn't have fetch as URL option,but this will work...also in cPanel it should be set as this if you want run cron at this way. GET https://***.com/clients/cron/?cron_key=DEARR7nW Quote
0 Nelsa Posted September 11, 2017 Report Posted September 11, 2017 Also I think you didn't install root certificate from comodo,in most case this will not be issue but some browser(many mobile )will not recognize it and i think that is reason why Plesk can't verify SSL.You should always upload 3 files(or copy/paste in 3 fields) when installing SSL..one is key,second your domain SSl and third intermediate root certificate from authority,this last can be downloaded from vendor website Quote
0 SowWun Posted September 11, 2017 Author Report Posted September 11, 2017 Hmm, I rechecked my cert and i did upload all parts, however I didn't install some perl module ( Crypt::SSLeay ), I did that, and everything seems smooth and fine Now I think it is working when I use Quote GET https://***.com/clients/cron/?cron_key=DEARR7nW but my cron reports sends me a full html page of my blesta portal page XD, sorry for being a newbie.. super confused Quote
0 Nelsa Posted September 11, 2017 Report Posted September 11, 2017 Your problem is not cron I just visited https://hostkoala.com/clients/cron/?cron_key=DEARR7nW and insted executing cron it redirect me to https://hostkoala.com/clients and that is why your cron is not executed from web ,you have rule that redirect all urls that doesn't exist to home page and it redirect also your cron url...now this url shouldn't be redirected..are you sure it is right key...When you visit that cron url in web browser you should see how cron is executed and this when done Attempting to run all tasks for Nelsahost web hosting service. All tasks have been completed. Attempting to run all system tasks. All system tasks have been completed. This is from my cron url,I'm running cron at this way for years.... You should check is that your key....you can try update cron key and than copy new one so you can try,this can happen only if cron key is wrong or there is some issue with .htaccess configuration.. Quote
0 MailEdge Posted July 4, 2019 Report Posted July 4, 2019 *** Update to the below solution, I thought it was working, it still may with some tweaking but I spent enough time with trial and error. Best way really is to use the Cron Key generated from Blesta and Fetch Command within your plesk scheduled tasks Works perfectly and allows you to use other services such as EasyCron === (As Nelsa mentioned within this thread) You can set cron to https://****.com/clients/cron/?cron_key=your-cron-key And check "fetch URL" Change your-cron-key to key you can find in settings-->system-->automation-->update cron key === Albeit this question is a bit old, some may find this helpful. Plesk Web Admin Edition running Blesta run every 5 min Tools Settings / Scheduled Tasks (create new Cron Job) /opt/psa/admin/bin/php -q/var/www/vhosts/YourDomain.xxx/httpdocs/index.php cron > /dev/null 2>&1 (Make sure there is "no" space between the php -q and /var as noted above) (above assumes default location of public files httpdocs) (Your location of php may vary depending on your hosting provider, or server install) Use Cron Style for the "Run" : */5 * * * * Will setup for every 5 min, every day, 365 days per year Apply and Run (for test) should execute with green success pop up. Best, Dave / MailEdge Quote
Question
SowWun
Hi, I'm having a little trouble running my cronjob via scheduled tasks in Plesk
I am running Blesta 4.0.1
This is my scheduled task list
I set it at every 5 minutes, everyday, every week/month, but it doesnt seem to run :(, anyone else have a prob like mine?
10 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.