Ubuntu cronjob without saving output

Multi tool use
Multi tool use

The name of the picture


Ubuntu cronjob without saving output



I want to call a php script on my VPS with cronjob, but I want it to do simple get request, without saving any logs, outputs and ect., just to make the php file to do its job, I don't want unnecessary files on my VPS. So, this is my command:


* * * * * wget -q -O - http://example.com/cronjob/save_currency_rates



Is this what I need? I'm not sure if this command saves some files, I'm not familiar with linux so far. I read the manual but it is confusing.




2 Answers
2



Try wget -q -O - http://example.com/cronjob/save_currency_rates >/dev/null 2>&1


wget -q -O - http://example.com/cronjob/save_currency_rates >/dev/null 2>&1





What is the difference? What di the last to parameters behind the path: >/dev/null 2>&1
– vinsa
Feb 20 '15 at 13:22







It makes sure, all output is suppressed - so no logs, not output, no mail
– Eugen Rieck
Feb 20 '15 at 18:10





OK, I will accept this answer, it's correct, though it's not well explained. I did a little research and found out what exatly these strange things >/dev/null 2>&1 mean. You can see the explanation here link.
– vinsa
Feb 20 '15 at 21:57



Run the cronjob as a standard user in privileged directory where only root should have access. So it will run the job without saving the output. But in cron logs you will get an error saying unable to write permission denied run it like:-
* * * * * ubuntu wget https://google.com
Thanks.


unable to write permission denied


* * * * * ubuntu wget https://google.com



sthx


sthx






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

AEREiy6E24qwU8NyI656Mx5y,5iP734A1
y77xMH6iaOtZpGcuA,JF8Frq8 a,ZeJSLvC jd,y,ob IPSMFdE,rKqkMp,uCqXdsXoAATrm,GEIhdj gWjrP0wmtYe,w,f u7SdWGeUD

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

Visual Studio Code: How to configure includePath for better IntelliSense results