Ben
Ben

Reputation: 11208

My cronjobs are creating the files being executed?

Since a week I've set up 2 cronjobs. One is executed every minute, the other once per night. After checking in via FTP I noticed many files were created. These files are named after the cronjob-files. Atm I've cleaned up 6.000 unwanted files but I'm curious what's wrong?

I'm executing the files via wget and they are stored in the root-folder (at the same level where the public_html dir is located).

Upvotes: 1

Views: 60

Answers (3)

DaveRandom
DaveRandom

Reputation: 88697

If you add the -O option to wget, and put > /dev/null to the end of your crontab entries, the problem will go away.

wget downloads the file you point it to, but -O writes the file to STDOUT instead of disk, and > /dev/null blackholes the data.

Upvotes: 1

Michael Berkowski
Michael Berkowski

Reputation: 270677

Sounds like wget is saving its output as it does by default. You can specify /dev/null as the output file, and it will not save anything.

wget http://example.com/yourfile.php -O /dev/null

Upvotes: 1

Blender
Blender

Reputation: 298364

Try writing the downloaded files to /dev/null, which basically eats all data shoved into it:

wget -O /dev/null foo.com

wget is made to download files. If you want, try looking at curl, which may suit your needs a bit more.

Upvotes: 2

Related Questions