Ive created a cron task at my commands folder named CronCommand.php
and I try executing that particular code on my terminal using pathtomyprotectedfolder/ .yiic Cron
and it executes smoothly, but when I want to run it by schedule and put it inside my crontab file at /etc/crontab It didnt work.
This is my code at crontab.
*/2 * * * * /usr/bin/php /var/www/AddressBook/addBook/protected/./yiic Cron cron >/dev/null
I want to run it every 2 minutes, Am I doing the right syntax? Im using Linux, and Is there a way to execute this command every 2 minutes without writing inside the crontab file at my etc/crontab/?
Page 1 of 1
Creating A Cron Job That Runs Every 2 Minutes
#2
Posted 01 February 2013 - 03:01 AM
*/2 * * * * /usr/bin/php /var/www/AddressBook/addBook/protected/yiic Cron >/dev/null
Should be all that is required, make sure that the user that the cron job runs as has the correct privileges to access the script.
jr_jags, on 01 February 2013 - 12:07 AM, said:
Ive created a cron task at my commands folder named CronCommand.php
and I try executing that particular code on my terminal using pathtomyprotectedfolder/ .yiic Cron
and it executes smoothly, but when I want to run it by schedule and put it inside my crontab file at /etc/crontab It didnt work.
This is my code at crontab.
*/2 * * * * /usr/bin/php /var/www/AddressBook/addBook/protected/./yiic Cron cron >/dev/null
I want to run it every 2 minutes, Am I doing the right syntax? Im using Linux, and Is there a way to execute this command every 2 minutes without writing inside the crontab file at my etc/crontab/?
and I try executing that particular code on my terminal using pathtomyprotectedfolder/ .yiic Cron
and it executes smoothly, but when I want to run it by schedule and put it inside my crontab file at /etc/crontab It didnt work.
This is my code at crontab.
*/2 * * * * /usr/bin/php /var/www/AddressBook/addBook/protected/./yiic Cron cron >/dev/null
I want to run it every 2 minutes, Am I doing the right syntax? Im using Linux, and Is there a way to execute this command every 2 minutes without writing inside the crontab file at my etc/crontab/?
#3
Posted 01 February 2013 - 05:31 AM
yes, Im using a root user in linux and the permissions are ok, but still it didnt execute
#5
Posted 03 February 2013 - 09:21 PM
Oh, I solved the problem, I just change the user to root just like this:
*/2 * * * * root /var/www/AddressBook/addBook/protected/yiic Cron >/dev/null
*/2 * * * * root /var/www/AddressBook/addBook/protected/yiic Cron >/dev/null
#6
Posted 03 February 2013 - 10:12 PM
Ok you are using /etc/crontab, you aren't really meant to edit that file on most linux systems. You are meant to edit a user specific crontab but I suppose it doesn't really matter if you want to run the script as root.
To do maintain crontabs correct you generally do:
this opens the default editor with the crontab for the user specified with the -u command.
Ubuntu CronHowto
Covers it pretty well for Debian based distros.
To do maintain crontabs correct you generally do:
crontab -e -u root
this opens the default editor with the crontab for the user specified with the -u command.
Ubuntu CronHowto
Covers it pretty well for Debian based distros.
jr_jags, on 03 February 2013 - 09:21 PM, said:
Oh, I solved the problem, I just change the user to root just like this:
*/2 * * * * root /var/www/AddressBook/addBook/protected/yiic Cron >/dev/null
*/2 * * * * root /var/www/AddressBook/addBook/protected/yiic Cron >/dev/null
#7
Posted 05 February 2013 - 05:27 PM
Oh so thats it, Is there a way to execute my cron code without applying */2 * * * * root /var/www/AddressBook/addBook/protected/yiic Cron >/dev/null on my etc/crontab?
Share this topic:
Page 1 of 1

Help












