1

I am kinda newbie to this, I have a php script which I want to execute after every 1 hour, for this I updated the crontab file inside the /etc directory but I am not able to see whether its actually being called.

Here's the entry in my crontab file

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

*/5 * * * * /usr/bin/curl -o temp.txt http://myurl.com/postparser.php

I am not even able to see any temp.txt file getting generated Can someone point me in the right direction

2 Answers 2

2

try running

*/5 * * * * /usr/bin/php /path/to/php/file/postparser.php

Change the /usr/bin/php part to your php executable path.

Sign up to request clarification or add additional context in comments.

4 Comments

and in php file all paths need to be absolute
in my server I dont see any such directory I have only usr/bin but no php . what should I do ?
write a page with only the following function phpinfo();. it will give you your php configuration details. In that find PHPRC which will be a dir. that dir will have php in it. So if your PHPRC has value /usr/lib/php try changing /usr/bin/php' to /usr/lib/php/php`
I do not see anything called PHPRC I think the server is using Zend framework..in that case what should be the path
1

Not sure about this but, changing just the file would have no effect. Try editing the tasks using the command crontab -e ("e" for editing).

If you want to edit the crontab for a certain user, use the -u parameter

for more, check the man: http://linux.die.net/man/1/crontab

Good luck

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.