D
D
Darklez2016-03-07 21:46:08
linux
Darklez, 2016-03-07 21:46:08

How to set up a cron task on Plesk?

Worked all day to set up cron job on Plesk.
To test a cron task, I used this method and created two documents: my_cron.php and an empty my_cron.txt
Code my_cron.php

<?php 
  $fd = fopen("my_cron.txt","a"); 
  fwrite($fd, "Обращение к файлу - ".date("d.m.Y H:i")."\r\n"); 
  fclose($fd); 
?>

Then I went to the Plesk panel -> Websites & Domains -> Scheduled Tasks
And added a task
2 * * * * wget -q -O /dev/null "http://site.com/testcron/my_cron.php"

Unfortunately, the task does not start, please help me figure it out

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Official account of the Timeweb team, 2020-07-16
@timeweb_team

First of all, it is worth checking the cron task execution log (according to the standard, in /var/log/cron.log).
In general, we advise you to try changing the handler and specify the full path to wget (by the /usr/bin/wget standard). Also try to change handler and check script execution with php 2 * * * * /usr/bin/php /path/to/site/testcron/my_cron.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question