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've installed the following CRON job using 'crontab -e' through putty on my server, but it won't run and I have no idea why.

This is the line I'm putting in and saving using 'crontab -e':

00 09-18 * * 1-5 /usr/bin/php5 /home/a/v/ava/public_html/p/app_availability_updates_flush.php

It's a simple script I want to run on the hour during business hours.

When I use 'crontab -l' it prints the following:

00 09-18 * * 1-5 /usr/bin/php5 /home/a/v/ava/public_html/p/app_availability_updates_flush.phproot@ds6639:~#

Does that look right?

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

Add a newline after your cron line. In other words, use crontab -e and press enter at the end of your current line.

share|improve this answer
    
That was it! Thanks Janne :D –  bbeckford Mar 27 '12 at 11:28
2  
Yep. A tip for you to similar issues in the future (for other software than cron, too): if output of some command gets messed up like in your original output (the shell prompt gets appended right after your previous command, instead of prompt getting a new clean line), you might need to add a newline after whatever you did. :) Way too many pieces of software parse their configuration files by splitting them with newlines, and if there's not a newline character after the last line ... well... that won't get parsed. Another typical gotcha: DOS/Windows newlines: \r\n is not loved in Unix world. –  Janne Pikkarainen Mar 27 '12 at 11:32
    
Noted, thanks for the follow up! –  bbeckford Mar 27 '12 at 18:05
add comment

To find out what isn't working check the mail for the account that is running the job as all output from the job gets mailed to it.

You can also capture the output yourself to a file which may be easier

00 09-18 * * 1-5 /usr/bin/php5 /home/a/v/ava/public_html/p/app_availability_updates_flush.php &>/tmp/cronjob.log
share|improve this answer
    
Thanks for your help Lain but Janne got it! –  bbeckford Mar 27 '12 at 11:28
add comment

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.