Read Mail / CRON Jobs
Read Mail / CRON Jobs
Hi, i am new to Ubuntu Server, and followed the guide. 2 issues only so far:
1. VNC startup by CRON doesnt work. The error on reboot does not find it in /bin/sh ? It does run from Webmin / command line with the same command line. Any clues?
2. Setup the sending mail - which works, but i can no longer see "Read User Mail" in Webmin - which i think is my favoured way. Have removed Webmin and reinstalled but no luck. Also tried to remove sSMTP but this hasnt worked either. How can i restore to before i started this section in the guide?
Loved experimenting so far... hope to continue and help appreciated! thx :-)
1. VNC startup by CRON doesnt work. The error on reboot does not find it in /bin/sh ? It does run from Webmin / command line with the same command line. Any clues?
2. Setup the sending mail - which works, but i can no longer see "Read User Mail" in Webmin - which i think is my favoured way. Have removed Webmin and reinstalled but no luck. Also tried to remove sSMTP but this hasnt worked either. How can i restore to before i started this section in the guide?
Loved experimenting so far... hope to continue and help appreciated! thx :-)
Re: Read Mail / CRON Jobs
Hi there,
First off welcome to the forums and I'm pleased to see you're still enjoying the experience. Some people get to this stage and wish they'd never started
OK, I'm afraid I've not got any answers straight off, just some questions.
Re VNC, where are you seeing this error and what isn't found in /bin/sh? Are you referring to the little script you wrote to start VNC or are you referring to the script that comes with VNC itself that lives in /.vnc/xstartup?
Re your "Read User Mail" problem. I'm confused sir. No user mail is installed by default in Ubuntu Server and so you should have never seen the "Read User Mail" option in Webmin? Unless you installed something like Postfix or Sendmail beforehand?
What do you see in place of where it used to display "Read User Mail" previously? Does Webmin display something like "no supported mail servers are detected" or something else?
Ian.
First off welcome to the forums and I'm pleased to see you're still enjoying the experience. Some people get to this stage and wish they'd never started
OK, I'm afraid I've not got any answers straight off, just some questions.
Re VNC, where are you seeing this error and what isn't found in /bin/sh? Are you referring to the little script you wrote to start VNC or are you referring to the script that comes with VNC itself that lives in /.vnc/xstartup?
Re your "Read User Mail" problem. I'm confused sir. No user mail is installed by default in Ubuntu Server and so you should have never seen the "Read User Mail" option in Webmin? Unless you installed something like Postfix or Sendmail beforehand?
What do you see in place of where it used to display "Read User Mail" previously? Does Webmin display something like "no supported mail servers are detected" or something else?
Ian.
Re: Read Mail / CRON Jobs
Ian, thanks for the reply, i probably should have been more clear! :-)
So the VNC error was a mail sent to my user account after reboot - it stated that the CRON job had not started, and that it could not find it. Run it manually from CRON and its fine. But the basic issue is that i cannot get the start VNC at boot to work in CRON, or in other methods you list. i have seen the post regarding the start time of the job - that looks ok on mine and is @reboot. So each time i want to use the desktop, i have to manually start it.
With regard to the "Read User Mail" i think i might have confused the issue - i selected at the initial install "mail server" as well as samba server etc. This let me see the error generated above for the VNC script not starting. I then proceeded to do the ssmpt install - this is when it failed to work in "Read User Mail". Now i see the following error in webmin:
The mail server set in the module configuration was not found on your system. You will need to adjust the configuration to use the correct server.
I have tried to use the module configuration - but cant really see what i need to do!
Appreciate your help.....
Steve
So the VNC error was a mail sent to my user account after reboot - it stated that the CRON job had not started, and that it could not find it. Run it manually from CRON and its fine. But the basic issue is that i cannot get the start VNC at boot to work in CRON, or in other methods you list. i have seen the post regarding the start time of the job - that looks ok on mine and is @reboot. So each time i want to use the desktop, i have to manually start it.
With regard to the "Read User Mail" i think i might have confused the issue - i selected at the initial install "mail server" as well as samba server etc. This let me see the error generated above for the VNC script not starting. I then proceeded to do the ssmpt install - this is when it failed to work in "Read User Mail". Now i see the following error in webmin:
The mail server set in the module configuration was not found on your system. You will need to adjust the configuration to use the correct server.
I have tried to use the module configuration - but cant really see what i need to do!
Appreciate your help.....
Steve
Re: Read Mail / CRON Jobs
I'm afraid I'm a bit stumped Steve, sorry
If clicking "Run now" on the VNC job in webmin works fine but the same job generates an error on boot then I honestly can't think what is wrong. I've been running the same thing on the last 6 versions of Ubuntu and have never seen this. All I can think is there is an issue elsewhere and this is merely a symptom of it.
After a bit of googling I came across something similar and the "fix" was to change the first line of the script from #!/bin/sh to #!/bin/bash. I'd be surprised if it makes a difference for you but it's got to be worth a shot. But I can't help but think you'll have other issues further down the line tho since it should work fine as it is.
Re your mail issue. Possibly the ssmtp install has stomped on the postfix install. I've never used the default MTA but if I was in your shoes I'd try the following and see if it helps:
Then go back into Webmin and refresh the modules (on the bottom left-hand side of the webmin UI) and see whether it sorts it out.
If clicking "Run now" on the VNC job in webmin works fine but the same job generates an error on boot then I honestly can't think what is wrong. I've been running the same thing on the last 6 versions of Ubuntu and have never seen this. All I can think is there is an issue elsewhere and this is merely a symptom of it.
After a bit of googling I came across something similar and the "fix" was to change the first line of the script from #!/bin/sh to #!/bin/bash. I'd be surprised if it makes a difference for you but it's got to be worth a shot. But I can't help but think you'll have other issues further down the line tho since it should work fine as it is.
Re your mail issue. Possibly the ssmtp install has stomped on the postfix install. I've never used the default MTA but if I was in your shoes I'd try the following and see if it helps:
Code: Select all
sudo apt-get remove --purge postfix
Code: Select all
sudo apt-get install postfix
Then go back into Webmin and refresh the modules (on the bottom left-hand side of the webmin UI) and see whether it sorts it out.
Re: Read Mail / CRON Jobs
Hi Ian,
Thanks for your help - pleased to say the postfix worked a treat, thanks! The good news is i can now show you the exact error from the CRON job as i can see read mail again! So the error generated is below and as i say, click Run Now in CRON and it works fine. Very strange....
-----------------------------------------------------------------
From root@mediaserver.BarNet (Cron Daemon)
To steve@mediaserver.BarNet
Date 11/03/2011 20:44
Subject Cron <steve@mediaserver> /home/steve/MyScripts/StartVNC.sh #StartVNC (failed)
Message contents
/bin/sh: /home/steve/MyScripts/StartVNC.sh: not found
-----------------------------------------------------------------
I did also find the google link and changed by job to #!/bin/bash but that did not do the job sadly.
Thanks for your ongoing help, its really appreciated!
Thanks for your help - pleased to say the postfix worked a treat, thanks! The good news is i can now show you the exact error from the CRON job as i can see read mail again! So the error generated is below and as i say, click Run Now in CRON and it works fine. Very strange....
-----------------------------------------------------------------
From root@mediaserver.BarNet (Cron Daemon)
To steve@mediaserver.BarNet
Date 11/03/2011 20:44
Subject Cron <steve@mediaserver> /home/steve/MyScripts/StartVNC.sh #StartVNC (failed)
Message contents
/bin/sh: /home/steve/MyScripts/StartVNC.sh: not found
-----------------------------------------------------------------
I did also find the google link and changed by job to #!/bin/bash but that did not do the job sadly.
Thanks for your ongoing help, its really appreciated!
Re: Read Mail / CRON Jobs
Great, partial progress so I'll keep plugging away
Can you try something for me please. Can you reboot your server and then go into webmin and manually run the StartVNC.sh cron job and attach the output from the script to your next post please.
Thanks.
Can you try something for me please. Can you reboot your server and then go into webmin and manually run the StartVNC.sh cron job and attach the output from the script to your next post please.
Thanks.
Re: Read Mail / CRON Jobs
Sorry, just thought of something else. Can you also run the following command and post the output please:
Thanks.
Code: Select all
ls -l /home/steve/MyScripts/StartVNC.sh
Thanks.
Re: Read Mail / CRON Jobs
Hi Ian,
So - as per your note, here is the out put from manually running the CRON job (note i took out the end of the string so i could see it run rather than hide it....):
Output from command /home/steve/MyScripts/StartVNC.sh ..
JOB RUN AT Mon Mar 14 22:19:31 GMT 2011
============================
New 'mediaserver:1 (steve)' desktop is mediaserver:1
Starting applications specified in /home/steve/.vnc/xstartup
Log file is /home/steve/.vnc/mediaserver:1.log
The output from the command is:
-rwxr-xr-x 1 steve steve 129 2011-03-13 22:17 /home/steve/MyScripts/StartVNC.sh
Hope that helps!
So - as per your note, here is the out put from manually running the CRON job (note i took out the end of the string so i could see it run rather than hide it....):
Output from command /home/steve/MyScripts/StartVNC.sh ..
JOB RUN AT Mon Mar 14 22:19:31 GMT 2011
============================
New 'mediaserver:1 (steve)' desktop is mediaserver:1
Starting applications specified in /home/steve/.vnc/xstartup
Log file is /home/steve/.vnc/mediaserver:1.log
The output from the command is:
-rwxr-xr-x 1 steve steve 129 2011-03-13 22:17 /home/steve/MyScripts/StartVNC.sh
Hope that helps!
Re: Read Mail / CRON Jobs
Thanks Steve. It helps but only in as much as the problem is not there
Have you encrypted your home directory per chance? If so, try moving the script elsewhere. So create a folder called MyScripts in /var/lib and move your script there. then update the cron job in Webmin to reflect this and reboot. Any joy now?
If not, issue the following two commands and send me the output from both please:
I'm running out of ideas but will keep plugging away until we get this one licked. Please bear with me
Have you encrypted your home directory per chance? If so, try moving the script elsewhere. So create a folder called MyScripts in /var/lib and move your script there. then update the cron job in Webmin to reflect this and reboot. Any joy now?
If not, issue the following two commands and send me the output from both please:
Code: Select all
crontab -l
Code: Select all
sudo crontab -l
I'm running out of ideas but will keep plugging away until we get this one licked. Please bear with me
Re: Read Mail / CRON Jobs
Hi Ian,
I moved the file, but no luck - same result. Does not start on boot (but writes the differnent mail error: vncserver: Could not create /home/steve/.vnc. ). However, i can run this maunally from the cron tab in webmin, with no error.
The output from the commands is:
steve@mediaserver:~$ crontab -l
@reboot /var/lib/StartVNC.sh #StartVNC
Second one is:
steve@mediaserver:~$ sudo crontab -l
[sudo] password for steve:
# * * * * * /home/steve/MyScripts/CPUTempShutdown.sh 35 45 #CPUShutDown
You are right on the encryption, i think i did select that, for no other reason than it seemed like a "good" thing to do.....
Thanks again,
Steve
I moved the file, but no luck - same result. Does not start on boot (but writes the differnent mail error: vncserver: Could not create /home/steve/.vnc. ). However, i can run this maunally from the cron tab in webmin, with no error.
The output from the commands is:
steve@mediaserver:~$ crontab -l
@reboot /var/lib/StartVNC.sh #StartVNC
Second one is:
steve@mediaserver:~$ sudo crontab -l
[sudo] password for steve:
# * * * * * /home/steve/MyScripts/CPUTempShutdown.sh 35 45 #CPUShutDown
You are right on the encryption, i think i did select that, for no other reason than it seemed like a "good" thing to do.....
Thanks again,
Steve