0

I am able to run sh /var/www/html/runcron.sh manually

but when i put below lines in crontab -e. It is not getiing called.

*/2 * * * * /var/www/html/runcron.sh

Am I missing anything here?

I have written below code inside runcron.sh

php -f /var/www/html/cronscan.php
Rakesh K
  • 692
  • 4
  • 13
  • 26
  • Does your script set a path? Have a look at this http://stackoverflow.com/q/2388087/3124333 – SiKing Jan 24 '17 at 20:48
  • Need more info. Any errors in /var/log/cron? Who owns /var/www/html/cronscan.php? Do you get notified when cron fails? If not, check /var/spool/mail/root – Deeh Jan 25 '17 at 03:51
  • I cant see directories called /var/log/cron and /var/spool/mail/root – Rakesh K Jan 25 '17 at 05:34

1 Answers1

0

Make sure the user running the cron has the proper permissions.And can access/ has ownership of the script. And just a quick reassurance, you want the job to run twice a minute?

  • I want to run cron every 2 minuts, By default root user will run the cron right? I logged in using root user and set the cron. – Rakesh K Jan 24 '17 at 20:58
  • Right. Every 2 minutes. And I believe root is default. But if you had someone else trying to run the crons, they would not have permission. Also, if root did not create the script, it is possible that it has permissions for only that user. – MTAlphawolf Jan 24 '17 at 21:05
  • Script was created by root user only. – Rakesh K Jan 25 '17 at 05:35