1

I've page "test.php" that runs a PHP script and return datetime / some results ... this page I call in a cron job, it runs successfully but I want to log the returned results in one file

I tried this ... cron_log.log was empty

wget -q -O - http://****/test.php >> /home/****/logs/cron_log/cron_log.log

I tried this ... but the cron_log.log contained date about the job execution, not the the response returned from the test.php

curl http://****/test.php > /home/****/logs/cron_log/cron_log.log 2>&1

Please can you help me in logging the returned results from curl?

P.S. I'm using a cPanel and I've access to the WHM

Update I need to append responses in the log file, so I can follow up the execution log of the cron job, this command (curl -k) truncates the log file, however I need to append returns on it.

curl -K http://****/test.php >> /home/****/logs/cron_log/cron_log.log
Doaa Magdy
  • 518
  • 5
  • 20

1 Answers1

2

You can use :

curl http://****/test.php >> /home/****/logs/cron_log/cron_log.log 2>&1
Fky
  • 2,133
  • 1
  • 15
  • 23