Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have the following line in the crontab:

 */30 * * * * /usr/bin/php /home/antoniocs/phpscripts/update-noip/update-noip.php

This script updates my no-ip account. It also writes to a log file saying what it did and did not due.

This is today's log file:

2009/08/06 11:30 - A tentar buscar ip
2009/08/06 11:30 - Ip encontrado - ***.***.***.***
2009/08/06 11:30 - Ip nao alterado - Abortar acesso ao no-ip
2009/08/06 12:00 - A tentar buscar ip
2009/08/06 12:00 - Ip encontrado - ***.***.***.***
2009/08/06 12:00 - Ip nao alterado - Abortar acesso ao no-ip
2009/08/06 12:30 - A tentar buscar ip
2009/08/06 12:30 - Ip encontrado - ***.***.***.***
2009/08/06 12:30 - Ip nao alterado - Abortar acesso ao no-ip
2009/08/06 13:00 - A tentar buscar ip
2009/08/06 13:00 - Ip encontrado - ***.***.***.***
2009/08/06 13:00 - Ip nao alterado - Abortar acesso ao no-ip
2009/08/06 13:30 - A tentar buscar ip
2009/08/06 13:30 - Ip encontrado - ***.***.***.***
2009/08/06 13:30 - Ip nao alterado - Abortar acesso ao no-ip
2009/08/06 14:00 - A tentar buscar ip
2009/08/06 14:00 - Ip encontrado - ***.***.***.***
2009/08/06 14:00 - Ip nao alterado - Abortar acesso ao no-ip
2009/08/06 14:30 - A tentar buscar ip
2009/08/06 14:30 - Ip encontrado - ***.***.***.***
2009/08/06 14:30 - Ip nao alterado - Abortar acesso ao no-ip
2009/08/06 15:00 - A tentar buscar ip
2009/08/06 15:00 - Ip encontrado - ***.***.***.***
2009/08/06 15:00 - Ip nao alterado - Abortar acesso ao no-ip

As you can see by the timestamp, today it started at 11:30 and then stopped and 15:00.

Also the cron is running:

antoniocs@acsserver:~$ /etc/init.d/cron status
 * cron is running

I don't know why this is happening. Some days ago this was running with out a problem (I have entries in the log every 30m). The only thing I did was recently upgrade my Ubuntu-Server (which has caused me some other problems)

Am I doing anything wrong here? Have the updates messed up cron??

EDIT:

This is what I have in the syslog for 7/8/09 at 15:00 (This is today's log but the same thing happened it stopped after 15:00)

146 Aug  7 15:00:01 acsserver CRON[30775]: Mount of private directory return code [0]
147 Aug  7 15:00:01 acsserver /USR/SBIN/CRON[30786]: (root) CMD ([ -x /usr/sbin/update-motd ] && /usr/sbin/update-motd 2>/dev/null)
148 Aug  7 15:00:01 acsserver /USR/SBIN/CRON[30811]: (antoniocs) CMD (/usr/bin/php /home/antoniocs/phpscripts/update-noip/update-noip.php )
149 Aug  7 15:00:01 acsserver /USR/SBIN/CRON[30810]: (root) CMD ([ -x /usr/sbin/update-motd ] && /usr/sbin/update-motd hourly 2>/dev/null)

There doesn't seem to be any errors :(

EDIT 2: After looking at the syslog file I noticed these lines:

Aug  7 22:10:01 acsserver /USR/SBIN/CRON[6023]: (root) CMD ([ -x /usr/sbin/update-motd ] && /usr/sbin/update-motd 2>/dev/null)
Aug  7 22:17:01 acsserver /USR/SBIN/CRON[6158]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Aug  7 22:20:01 acsserver /USR/SBIN/CRON[6207]: (root) CMD ([ -x /usr/sbin/update-motd ] && /usr/sbin/update-motd 2>/dev/null)
Aug  7 22:30:01 acsserver CRON[6336]: Mount of private directory return code [256]
Aug  7 22:30:01 acsserver /USR/SBIN/CRON[6350]: (root) CMD ([ -x /usr/sbin/update-motd ] && /usr/sbin/update-motd 2>/dev/null)
Aug  7 22:30:01 acsserver /USR/SBIN/CRON[6354]: (antoniocs) CMD (/usr/bin/php /home/antoniocs/phpscripts/update-noip/update-noip.php )
Aug  7 22:30:01 acsserver postfix/sendmail[6367]: fatal: open /etc/postfix/main.cf: No such file or directory
Aug  7 22:39:01 acsserver /USR/SBIN/CRON[6523]: (root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 | xargs -n 200 -r -0 rm)
Aug  7 22:40:01 acsserver /USR/SBIN/CRON[6574]: (root) CMD ([ -x /usr/sbin/update-motd ] && /usr/sbin/update-motd 2>/dev/null)
Aug  7 22:50:01 acsserver /USR/SBIN/CRON[7044]: (root) CMD ([ -x /usr/sbin/update-motd ] && /usr/sbin/update-motd 2>/dev/null)
Aug  7 23:00:01 acsserver CRON[7173]: Mount of private directory return code [256]
Aug  7 23:00:01 acsserver /USR/SBIN/CRON[7193]: (antoniocs) CMD (/usr/bin/php /home/antoniocs/phpscripts/update-noip/update-noip.php )
Aug  7 23:00:01 acsserver /USR/SBIN/CRON[7195]: (root) CMD ([ -x /usr/sbin/update-motd ] && /usr/sbin/update-motd hourly 2>/dev/null)
Aug  7 23:00:01 acsserver /USR/SBIN/CRON[7196]: (root) CMD ([ -x /usr/sbin/update-motd ] && /usr/sbin/update-motd 2>/dev/null)
Aug  7 23:00:01 acsserver postfix/sendmail[7211]: fatal: open /etc/postfix/main.cf: No such file or directory
Aug  7 23:09:01 acsserver /USR/SBIN/CRON[7390]: (root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 | xargs -n 200 -r -0 rm)

So it is running the php script. I just don't know what /etc/postfix/main.cf is. In my php script I only use curl to make some connections.

EDIT 3:

Seems that the problem really was the postfix. I followed these instructions -> https://help.ubuntu.com/7.04/server/C/postfix.html and just set up the main.cf file that the cron was complaining about and the php script now seems to be okay.

Still don't fully understand why this was happening. If anyone has any theory on why the heck this happened and why I needed the postfix to run my php script, please let me know!!

Thanks for all the help guys!

PS: Also if anyone knows what the mount error is please also tell me :(

share|improve this question

2 Answers 2

Your final "EDIT 2" logfile shows that your postfix system isn't set up properly. When a cron script sends output to stdout or stderr (eg, any error messages in the script) , it sends an email (to root@localhost by default), and you need a working mail server for that to happen.

It looks very much like your script is failing for some other reason and is writing something to stderr or stdout, but because you don't have a working postfix setup you're losing that information. It's quite likely those error emails have the information you need to work out why your script is failing.

That, of course, is assuming this isn't your error: Aug 7 22:30:01 acsserver CRON[6336]: Mount of private directory return code [256]

Either way, you should fix your postfix setup.

share|improve this answer
    
Any suggestions or links to suggestions on how I might do that? –  AntonioCS Aug 9 '09 at 13:11
1  
afaik cron sends any output done by php cli scripts as mail –  Karsten Aug 10 '09 at 11:52

I don't quite see the problem. Your crontab says to run every 30 minutes (*/30), and your log shows 3 lines for each time it runs - which happens every 30 minutes.

Is there something you can translate from the log which suggests that it's not running anew at :00 and :30?

When you say it "stopped a[t] 15:00", do you mean that you copied this log significantly after that, and didn't see the entries at 15:30, 16:00, etc as you expected to?

share|improve this answer
    
He said that this is "today's log". Don't know when he sent it, but it definitely should contain entries for the time between 0 and 11. Right? –  innaM Aug 7 '09 at 8:51
    
@Manni: Yes, that is correct Manni, it should have entries for the full day and not just between 11 and 15 @Jonathan Matthews: When I copied the log file contents it was 17:00 so it should have had more entries. –  AntonioCS Aug 7 '09 at 11:35
    
I wonder what happens when you run it twice in succession, i.e. when your address hasn't changed between invocations? Some dyn-dns scripts I've used in the past exited silently if they didn't have any work to do. Also, the log entries seem to be application-level, not cron itself logging. Could you (a) translate them and (b) see if you can find the log that cron writes to when it executes - which is /var/log/syslog on my stock Debian box here. –  Jonathan Matthews Aug 7 '09 at 13:50
    
I did this script. What happens if it doesn't is it doesn't do anything. It shows that in the log. The 'Ip nao alterado - Abortar acesso ao no-ip' mean 'Ip not changed. Aborting access to no-ip'. But it just does an exit from the script. I'll look in the syslog and place what I find in the post –  AntonioCS Aug 7 '09 at 14:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.