Dear, I broke my head and googled for a long time, and did not find a fully working example. This cron task, when testing, seemed to work, when it finally got into the system, an error crashes.

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 crown: at the specified time, this URL was called with the parameter, well, and I throw the execution log into the site logs.

    2 answers 2

    Well, it’s said in black and white

    grandchild # 17905 failed with exit status 2

    So, wget cannot execute and crashes due to error 2

    Look at the manual and see

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

    Therefore, the parameters cannot 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 
    • check the path (/ usr / bin / wget) most likely you moved to freeBsd, and the path will be like this: / usr / local / bin / wget or there is no wget command at all - Alex Kapustin
    • / usr / bin / wget this is for sure, checked when I found this method, Ubuntu OS - trec

    Did as advised above, alas did not help.

    Removed throw in the log, cron worked, but a file is created in the working directory add.php? Cs = 2 is empty. and each time you run a crown a new one is created there.

    Leave so.

    Later I will write another cron, which will delete these files.

    • So it is not clear .. what else did you expect? Strange just that it is empty. You didn’t think that >> will redirect the download result from the URL? - cy6erGn0m
    • Yes, figs it, which I expected, the script, after it works, gives the list of changes, so I thought it would save it, but alas, PHP is not Python. For this I will not puzzle, and I will add another cron. Thanks for the help. - trec 2:12 pm
    • 30 * / 12 * * * / usr / bin / GET ' site.net/res/add.php?cs=2 ' >> /home/www/site/log/loggraber.txt - Alex Kapustin