Why the cron job create a new file every time the the cron is launched ?
I’ve a tons of files with the same name with a new extension.
|OS type and version
||CentOS Linux 7.9.2009
Please supply more information like what os, version of VM and what the cron job is running
I’ve edited the 1st post, the job is running a php file.
well what is creating the files ? cron won’t create anything unless you tell it to so I guess your php file is failing somehow … what is the content of these files ?
Inside the file created by cron there’s the output like echo inside the php file.
so your php file is creating those files… i guess whoever provided this cron php script can help. eg, remove echo or whatever.
if not, provide the actual cron job and post the contents of the php file.
Your not running a php file that has been coded to run on a web server ? This will never work very well, what you may be seeing is loads of errors from php where it expecting to find variables that are only available when you run php through a web server. Duel purpose php programs are tricky to code, I have coded a few in the past but gave up on it and now code php either for the web server or cli … cron will always use cli
You can call a php script also with wget so… But it’s the first time that inside the root folder i’ve found those files.
You haven’t provided any information we need to answer this question…and unless the script the cronjob is running is one of ours, we probably aren’t the best people to answer your question (and we do not have any scripts written in PHP, so it’s definitely not one of ours).
The script it’s mine and it’s a simple call to an API, when the cron call the php file create a file with the output of php script.
so how does cron/php handle the output from wget ? … I guess it writes it to a file … maybe just send the output/errors to null in the in the cron job … Also has anything changed on the server, like changing php mode or version ?
The php mode and version are the same, so with > /dev/null solve the problem.
good but don’t forget, as you have not redirected the errors this may still write files if the php file has an error
This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.