Cron işi boş dosyayı her çalıştığında yaratıyor

1 Cevap php

Ben yayınlanmıştır gerekiyor taslak haber mesaj olup olmadığını görmek için her dakika çalıştırmak istediğiniz bir php komut dosyası var. Ben cPanel cron komutu için "wget" kullanıyordum, ama bu ana dizinde o koştu her zaman boş bir dosya oluşturarak olduğunu (birkaç gün sonra) fark ettim. Ben bunun olmasını durdurmak için gereken bir şey var mı?

Teşekkürler.

1 Cevap

Ishal wget, varsayılan olarak, ben hatırlamak gerekiyor ne, bir çıktı dosyası oluşturur.

Ve /dev/null hedef dosyaya (It's a "special file" that will "eat" everything you can write to it) olarak kullanmak - Muhtemelen onun yazma çıkış dosya belirtmek için, wget bazı seçeneğini kullanmanız gerekir


Judging from man wget, the -O or --output-file option would be a good candidate :

-O file
--output-document=file
The documents will not be written to the appropriate files, but all will be concatenated together and written to file.

Eğer öyleyse, bu gibi bir şey kullanmak gerekebilir:

wget -O /dev/null http://www.example.com/your-script.php


And, btw, the output of scripts run from the crontab is often redirected to a logfile -- it can always help.

Böyle bir şey bu konuda yardımcı olabilir:

wget -O /dev/null http://www.example.com/your-script.php >> /YOUR_PATH_logfile.log

Ve ayrıca başka bir dosyaya hata çıktı yönlendirmek isteyebilirsiniz (can be useful, to help with debugging, the day something goes wrong):

wget -O /dev/null http://www.example.com/your-script.php >>/YOUR_PATH/log-output.log 2>>/YOUR_PATH/log-errors.log