PHP script in cron task

Dear, I have been racking my brains and googling for a long time, and have not found a fully working example. Here is the cron task, when I tested it, it seemed to work, when I finally got it into the system, an error occurred.

30 */12 * * * /usr/bin/wget http://site.net/res/add.php?cs=2>>/home/www/site/log/loggraber.txt

Here is the error:

CRON[17904]: (CRON) error (grandchild #17905 failed with exit status 2)

The essence of the cron: at the specified time, this url was called with a parameter, well, I transfer the execution log to the site logs.


Answer 1, authority 100%

Well, it’s said in black and white

grandchild #17905 failed with exit status 2

So wget can’t run and crashes with error 2

Look at manualand see

2
Parse error—for instance, when parsing command-line options, the ‘.wgetrc’ or ‘.netrc’…

So the parameters can’t be parsed. I would try if I were you

30 */12 * * * /usr/bin/wget 'http://site.net/res/add.php?cs=2' >> /home/www/site/log/loggraber.txt

Answer 2

I did as advised above, alas, it did not help.

Removed throwing in the log, cron worked, but a file is created in the working directory add.php?cs=2 empty. and each time the cron is executed, a new one is created in the same place.

I’ll leave it like that.

Later I will write another cron that will delete these files.