PHP scripts not executed by cron on Linux server

51 views Asked by At

I host a couple of websites which have live twitter feeds. My set up means that each website has a tweets.php file that will get the tweets using twitter OAUTH and then write it to a text file. I then use a javascript file to get the JSON from the raw text (.txt) file.

Until I learnt about cron jobs I was refreshing the tweets.php files myself as part of my day-to-day admin.

However, I've set up my cron jobs and they don't seem to be executing the php file or writing to the text file (both have 777 permissions on them).

Furthermore, I have both a cron file created using crontab -e but there is also a directory called cron.hourly. As I wasn't sure which one to use I have put the cron jobs in both but they don't seem to be executing. Here are my files:

@daily /etc/webmin/mysql/backup.pl --all
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /etc/webmin/status/monitor.pl
0 * * * * /var/www/html/websiteone.co.uk/wp-content/themes/websiteone/tweets.php
0 * * * * /var/www/html/websitetwo.co.uk/wp-content/themes/websitetwo/tweets.php

And the cron file (called 'twitter') within the cron.hourly directory is:

/var/www/html/websiteone.co.uk/wp-content/themes/websiteone/tweets.php
/var/www/html/websitetwo.co.uk/wp-content/themes/websitetwo/tweets.php

Now I've checked the cron logs and they seem to be running the jobs hourly but the tweets aren't updating and neither is the raw text file.

08:00:01 ip-10-142-232-156 CROND[25986]: (root) CMD (/var/www/html/websitetwo.co.uk/wp-content/themes/websitetwo/tweets.php)
Jun  5 08:00:01 ip-10-142-232-156 CROND[25987]: (root) CMD (/etc/webmin/status/monitor.pl)
Jun  5 08:00:01 ip-10-142-232-156 CROND[25988]: (root) CMD (/var/www/html/websiteone.co.uk/wp-content/themes/websiteone/tweets.php)
Jun  5 08:01:01 ip-10-142-232-156 CROND[26014]: (root) CMD (run-parts /etc/cron.hourly)
Jun  5 08:01:01 ip-10-142-232-156 run-parts(/etc/cron.hourly)[26014]: starting 0anacron
Jun  5 08:01:01 ip-10-142-232-156 run-parts(/etc/cron.hourly)[26023]: finished 0anacron
Jun  5 08:01:01 ip-10-142-232-156 run-parts(/etc/cron.hourly)[26014]: starting twitter
Jun  5 08:01:01 ip-10-142-232-156 run-parts(/etc/cron.hourly)[26033]: finished twitter

Apologies if I'm missing something obvious but scheduled task automation is a new area for me.

0

There are 0 answers