Search code examples
cronwgetcron-task

How to prevent Cron Task from writing file on server?


I'm facing this problem :
When I execute a CRON task from my Web Server with this command :

wget https://mon-url.com/file/cron.php >/dev/null 2>&1

It creates new files cron.php1, cron.php2, ... in my /root directory and It takes a lot of space. How can I prevent this ?
Thanks


Solution

  • You can use -O /dev/null what will write the output file to /dev/null

    wget -O /dev/null https://mon-url.com/file/cron.php >/dev/null 2>&1

    Or -O- which will output it to stdout.

    wget -O- https://mon-url.com/file/cron.php >/dev/null 2>&1