Webmin, cron & vncserver
Posted: August 26th, 2012, 7:38 am
Folks,
Using 12.04LTS server.
I was having a hard time stopping the eMail output from a cron job within WebMin - even with > /dev/null.
(edited 18Sep12) This was after doing the configuration step "How to send email alerts from Ubuntu Server using ssmtp"
I chose the cron job method to load vncserver at boot as described and I used the command for Webmin " /home/myusername/MyScripts/StartVNC.sh > /dev/null " as shown and I would always get what appeared to be two eMails from the cron job - yes ssmtp is installed - the first was to the correct eMail address as defined in the ssmtp.conf file and the second was a bounce response from the eMail provider stating that the eMail address of the user could not be found.
I have setup my server with myusername and do not have an eMail address for it! The bounce eMail was for myusername@myservername.
So how to fix it?
I tried editing the ssmtp.conf file - and that didn't work.
Tried editing the cron command in Webmin. That didn't work and it really seemed as though Webmin was ignoring the > /dev/null part of the command.
Did a search for "linux output to /dev/null" and found this site;
http://www.cyberciti.biz/faq/how-to-red ... o-devnull/
they explained that - You can send output to /dev/null, by using command > /dev/null syntax. However, this will not work when command will use the standard error (FD # 2). So you need to modify > /dev/null as follows to redirect both output and errors to /dev/null:
> /dev/null 2>&1
and by adding the 2>&1 to the /dev/null (not sure what they mean) in the ssmtp.conf file I no longer receive any eMails about vncserver. Which is what I was trying to accomplish.
Hope this helps someone.
Dave
Using 12.04LTS server.
I was having a hard time stopping the eMail output from a cron job within WebMin - even with > /dev/null.
(edited 18Sep12) This was after doing the configuration step "How to send email alerts from Ubuntu Server using ssmtp"
I chose the cron job method to load vncserver at boot as described and I used the command for Webmin " /home/myusername/MyScripts/StartVNC.sh > /dev/null " as shown and I would always get what appeared to be two eMails from the cron job - yes ssmtp is installed - the first was to the correct eMail address as defined in the ssmtp.conf file and the second was a bounce response from the eMail provider stating that the eMail address of the user could not be found.
I have setup my server with myusername and do not have an eMail address for it! The bounce eMail was for myusername@myservername.
So how to fix it?
I tried editing the ssmtp.conf file - and that didn't work.
Tried editing the cron command in Webmin. That didn't work and it really seemed as though Webmin was ignoring the > /dev/null part of the command.
Did a search for "linux output to /dev/null" and found this site;
http://www.cyberciti.biz/faq/how-to-red ... o-devnull/
they explained that - You can send output to /dev/null, by using command > /dev/null syntax. However, this will not work when command will use the standard error (FD # 2). So you need to modify > /dev/null as follows to redirect both output and errors to /dev/null:
> /dev/null 2>&1
and by adding the 2>&1 to the /dev/null (not sure what they mean) in the ssmtp.conf file I no longer receive any eMails about vncserver. Which is what I was trying to accomplish.
Hope this helps someone.
Dave