I just created a extension to manage system cron jobs with Yii that can also be used to run Application console commands.
http://www.yiiframew...on/yii-crontab/
Page 1 of 1
[Extension] Crontab
#2
Posted 01 August 2010 - 05:26 PM
just release version 0.3
Previous jobs are now retrieve from crontab file for further modifications and stuff...
Previous jobs are now retrieve from crontab file for further modifications and stuff...
#3
Posted 02 August 2010 - 01:47 AM
Looks nice.
Two notes:
- You should better use __construct() as constructor name.
- Maybe add a comment, that the crontab file must be writeable for the webserver if you want to manage jobs through a webinterface. This should be a well considered decision, as it can open up a huge security hole.

- You should better use __construct() as constructor name.
- Maybe add a comment, that the crontab file must be writeable for the webserver if you want to manage jobs through a webinterface. This should be a well considered decision, as it can open up a huge security hole.
#4
Posted 02 August 2010 - 02:56 PM
Crontab file access is based upon user permission. If user is wwwuser1, the extension creates a crontab file(typically, this is just a normal text file) for that user in the directory of this extension and then use 'crontab file' unix command to load the jobs in system crontab for that user. I guess there shouldn't be any security holes.
#6
Posted 31 August 2010 - 04:26 AM
Can you please add other documentation?
I've extracted everything under the folder extensions, but when you try to do
It will exit with this error:
Can you please provide further informations like what to put into yii config?
I've extracted everything under the folder extensions, but when you try to do
$cron = new Crontab('my_crontab'); // my_crontab file will store all added jobs
It will exit with this error:
PHP Error Descrizione include(Crontab.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory File Sorgente C:\xampp\htdocs\yii-1.1.3\framework\YiiBase.php(338)
Can you please provide further informations like what to put into yii config?
#7
Posted 01 September 2011 - 12:09 PM
Hi!
I have some trouble using your extension... I've posted here http://www.yiiframew...ab-help-please/
Can you help me?
Thanks in advance!
Cheers!!!
I have some trouble using your extension... I've posted here http://www.yiiframew...ab-help-please/
Can you help me?
Thanks in advance!
Cheers!!!
#8
Posted 26 September 2012 - 09:59 PM
In the usage guide document (http://www.yiiframew...ion/yii-crontab) has code lines
I don't know where is php file to put these code lines? Please help me
thanks
Usage See the following code example: // Usage with ApplicationConsole and normal jobs $cron = new Crontab('my_crontab'); // my_crontab file will store all added jobs $jobs_obj = $cron->getJobs(); // previous jobs saved in my_crontab foreach($jobs_obj as $job) echo $job->getCommand(); $cron->eraseJobs(); // erase all previous jobs in my_crontab // Application console job $cron->addApplicationJob('yiicmd', 'test1', array(), '*'); // to change job values: $jobs_obj = $cron->getJobs(); $jobs_obj[0]->setParams(array("'datetime'")); $jobs_obj[0]->setCommandName('test'); // <= adds a job with: * * * * * php /home/user/my_project/www/yiicmd.php test 'datetime' // add an other job $job = new CronApplicationJob('yiicmd', 'test', array("'datetime"), '0', '0'); // run every day $job->setParams(array("'date'")); $cron->add($job); // <= adds a second job with: 0 0 * * * php /home/user/my_project/www/yiicmd.php test 'date' // add a regular cron job $cron->addJob('/home/user/myprogram.bin', '0', '0', '*', '*', '1'); // run every monday $jobs_obj = $cron->getJobs(); echo $jobs_obj[2]->getCommand(); // <= adds a third job with: 0 0 * * 1 /home/user/myprogram.bin $cron->removeJob(2); // removes job with offset 2 (last added here) $cron->saveCronFile(); // save to my_crontab cronfile $cron->saveToCrontab(); // adds all my_crontab jobs to system (replacing previous my_crontab jobs)
I don't know where is php file to put these code lines? Please help me
thanks
#9
Posted 21 November 2012 - 05:25 AM
Split function php is deprecated, us preg_split!!
This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.
This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.
Share this topic:
Page 1 of 1