How can I run a cron job with arguments and pass results to a log?

后端 未结 2 2056
旧时难觅i
旧时难觅i 2021-02-20 17:38

Example:

* * * * * /usr/bin/php /full/path/to/script.php arg1 arg2 > /full/path/to/logfile.log

The script runs and accesses the arguments ju

2条回答
  •  离开以前
    2021-02-20 18:20

    Does the command work correctly from the command line? It may be possible that the arguments contain some characters treated specially by shell. In that case you need to quote the whole command to prevent shell from tinkering with the arguments.

提交回复
热议问题