Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have placed the following information into my crontab file by entering "crontab -e" (in both root and "ubuntu" users, on a 32 bit Canonical Ubuntu AWS instance):

@reboot /usr/bin/php /usr/share/nginx/www/cron/updateIp.php

I have also tried:

@reboot /usr/bin/php /usr/share/nginx/www/cron/updateIp.php >> /home/ubuntu/crontab.log

And /home/ubuntu/crontab.log contains nothing after two reboots.

I imagine that php and/or nginx is not loaded when this cronjob is attempting to run?

Without any error logs to check however, I am at a loss as to what to do next..?

EDIT: Even after logging into the box via SSH with the same user that the crontab -e was created under... the cronjob does not run.

EDIT 2: (results of syslog):

Nov  9 13:29:02 ip-10-122-254-128 CRON[603]: (root) CMD (php /usr/share/nginx/www/cron/updateIp.php)
Nov  9 13:29:02 ip-10-122-254-128 CRON[604]: (ubuntu) CMD (/usr/bin/php /usr/share/nginx/www/cron/updateIp.php >> /home/ubuntu/crontab.log 2>&1)

EDIT 3: This link actually provided the answer I was looking for. Apparently I needed to install php-cgi and mention it specifically, even though whereis php does not show it? Simply installing php5-cgi and changing /usr/bin/php to /usr/bin/php-cgi worked like a charm. I already had php5-cli and php5-fpm installed so I figured php5-cgi wasn't necessary, but I suppose it must have been.

share|improve this question
What AMI id are you running? In what EC2 region? – Eric Hammond Nov 8 '11 at 3:16
Try this >> /home/ubuntu/crontab.log 2>&1. – quanta Nov 8 '11 at 3:18
As with any cron problem, the first place you should look at is the environment, quickly followed by permissions. – Zoredache Nov 8 '11 at 8:35
@EricHammond I am running ami-a7f539ce (32 bit oneric) in us-east-1. – darkAsPitch Nov 8 '11 at 16:18
In addition to sending stdout to the log file, also send stderr so you get error messages: ...updateIp.php >> /home/ubuntu/crontab.log 2>&1 – Eric Hammond Nov 8 '11 at 21:33
up vote 3 down vote accepted

Check stat cron is running

status cron 
cron start/running, process 1380


ps aux | grep cron
root      1380  0.0  0.0   2092   876 ?        Ss   Nov03   0:02 cron

If it's running or not then have a look in /var/log/syslog and see if there are any relevant messages.

grep CRON /var/log/syslog
Nov  9 11:18:29 iain-ubuntu cron[3509]: (CRON) STARTUP (fork ok)
Nov  9 11:18:29 iain-ubuntu cron[3509]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
share|improve this answer
I have checked to see that cron is running, and was elated to see my commands listed in the syslog file (right around the time they should be), but there wasn't much other information explaining why exactly the ip_address.txt file did not update itself. It simply claims the php script was run, and shows me the commands, but ip_address.txt is unchanged. – darkAsPitch Nov 9 '11 at 19:08
@darkAsPitch: If ip_address.txt is unchanged, this probably means that cron is working fine, but that your updateIp.php isn't working as expected. To test this, replace updateIp.php which something which simply prints to standard out. You should see the output in /home/ubuntu/crontab.log. Remember that cron runs with a minimal environment which is different then your typical commandline environment. – Stefan Lasiewski Nov 9 '11 at 19:26
for some reason I had to specify /usr/bin/php-cgi from the crontab file, when /usr/bin/php works normally. It not works. Thank you for all your help. – darkAsPitch Nov 28 '11 at 4:09

Most probably, the cron service is turned off

share|improve this answer
cron was indeed running, but I had to specify php-cgi instead of php in the crontab area for some reason. Do you know why? – darkAsPitch Nov 9 '11 at 22:43

Your Answer


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.