0

I'm using cron tasks every 3 mins, the result is logged in my cron.log. Also after executing (wget) certain php file, it's name (with 0 bytes filesize) is copied to root, spaming it - see the figure

How can I prevent cron from filling up my root partition on Debian?

here is a spam screen - Spam Screen

My cron task is /usr/bin/wget http://mydomain.com/myphpscript.php >/dev/null 2>&1

1
  • If one of the answers solved your problem, you should mark the answers as correct. This makes the question disappear from open questions. Otherwise please update.
    – Jonathan
    Feb 15, 2012 at 10:38

2 Answers 2

1

If you want to throw away the output of the script, tell wget to throw it away with -O /dev/null

using wget in cron to hit a php page begs the question of whether you couldn't just be running the php page with the php cli by installing the php5-cli package and running php /path/to/phpscript.php Is this really a script that needs to be accessible form both the web and from cron?

9
  • yes, because i execute it manually from time to time after editing, much thanks!
    – dr_darwin
    Feb 3, 2012 at 7:28
  • php /path/to/phpscript.php doesnt' work, though php5-cli is already the newest version, what's the matter?
    – dr_darwin
    Feb 3, 2012 at 14:24
  • @dr_darwin can you be more specific than "doesn't work"? Do you get an error? if so, what?
    – stew
    Feb 3, 2012 at 14:25
  • ..i have an idea - i have restricted an access to php by ip adress. When i used wget - i allowed my.ser.ver.ip, and what will be ip adress while directly executing php file? '127.0.0.1', won't it?
    – dr_darwin
    Feb 3, 2012 at 14:46
  • how did you make this restriction?
    – stew
    Feb 3, 2012 at 15:08
0

Use -o /dev/null and -O /dev/null to throw away both the download and the output of wget.

Running it from shell as stew suggested seems better. After editing you could just run the same shell script.

It allso seems that you run your script as root. It is better to not run such scripts as root if possible.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .