Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have added a new line to my crontab file, but this line won't work. This is the code of my crontab file:

# Music scrobbler
# Every 5 minutes
*/5 * * * * php -f /var/www/Music/scrobble/index.php


# Radio scrobbler
# Every Minute
*/1 * * * * php -f /var/www/fmstats/Scrobble/cron/scrobble.php > /fmstats.log

The first line works perfectly, but the second does nothing. It should output a list of radio stations but fmstats.log is always empty. It should also add a row to a database wich doesn't happen either.

If I execute the file manualy using the console or via the browser, it works just fine.

share|improve this question

1 Answer 1

This is probably a question of permissions. Doublecheck: What user is running the cronjob, and the permissios on /fmstats.log

I quess if you change your path to the outputfile like lets sayD /tmp/fmstats.log you will get a file in your /tmp folder.

You should also try a full path:

/1 * * * * php -f /var/www/fmstats/Scrobble/cron/scrobble.php > /var/www/fmstats/Scrobble/cron/fmstats.log
share|improve this answer
    
The output isn't the priority, the php script sends data to the database and this doesn't happen either. The script is being run as root, so this shouldn't be a problem. –  Jerodev Jun 26 '12 at 17:45
    
Yes. It could be possible that the script doesn't execute because of the permission error. Have you tried the full path Version? –  rechengehirn Jun 26 '12 at 18:45

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.