- Posts: 6
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Regarding setting cron job
- bava
- Topic Author
- Offline
- New Member
Less
More
7 years 6 months ago #142072
by bava
Regarding setting cron job was created by bava
hi,
i want to run a cron job on daily basis which may interact with database tables inserting and updating , how to do it with limesurvey version 2.50+ . adding a controller like CronController is not working, and how to write a crontab command in linux .
Thanks
i want to run a cron job on daily basis which may interact with database tables inserting and updating , how to do it with limesurvey version 2.50+ . adding a controller like CronController is not working, and how to write a crontab command in linux .
Thanks
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
7 years 6 months ago #142075
by jelo
You will have to create a script/programm/command first.
Then you create a cronjob.
Depending on your operatingsystem and serversettings there might be different ways to do it.
A good introduction is here:
www.pantz.org/software/cron/croninfo.html
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Regarding setting cron job
What kind of script/program do you use to interact with database tables?bava wrote: i want to run a cron job on daily basis which may interact with database tables inserting and updating , how to do it with limesurvey version 2.50+ . adding a controller like CronController is not working, and how to write a crontab command in linux .
Thanks
You will have to create a script/programm/command first.
Then you create a cronjob.
Depending on your operatingsystem and serversettings there might be different ways to do it.
A good introduction is here:
www.pantz.org/software/cron/croninfo.html
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
- bava
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
7 years 6 months ago #142077
by bava
Replied by bava on topic Regarding setting cron job
class CronController extends LSYii_Controller
{
public $layout='bare';
public function actionTestCron()
{
//code stuffs goes here
}
}
cron command crontab :
*/5 * * * * php -q /path/to/domain/public_html/application/controllers/cron/testcron 2>>/var/www/domain/public_html/testcron.log
thanks.
{
public $layout='bare';
public function actionTestCron()
{
//code stuffs goes here
}
}
cron command crontab :
*/5 * * * * php -q /path/to/domain/public_html/application/controllers/cron/testcron 2>>/var/www/domain/public_html/testcron.log
thanks.
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
7 years 6 months ago #142083
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Regarding setting cron job
Any error logs? I would start from the command line:
What is the output of:
php /path/to/domain/public_html/application/controllers/cron/testcron
Before digging into details of Yii and Limesurvey get a simple php command running.
Sometime there are serverside restrictions or some path mistypes etc.
With Yii specific stuff I am not competent enough.
But you should post the exact version/build of LimeSurvey you're using.
What is the output of:
php /path/to/domain/public_html/application/controllers/cron/testcron
Before digging into details of Yii and Limesurvey get a simple php command running.
Sometime there are serverside restrictions or some path mistypes etc.
With Yii specific stuff I am not competent enough.
But you should post the exact version/build of LimeSurvey you're using.
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
- bava
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
7 years 6 months ago - 7 years 6 months ago #142085
by bava
Replied by bava on topic Regarding setting cron job
versionnumber' = "2.50+"
dbversionnumber'] = 258;
'buildnumber'] = 160517;
error log is empty without any error messages, is there any file to put in server like cron.php under public_html using the digital ocean server
Thanks
dbversionnumber'] = 258;
'buildnumber'] = 160517;
error log is empty without any error messages, is there any file to put in server like cron.php under public_html using the digital ocean server
Thanks
Last edit: 7 years 6 months ago by bava.
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
7 years 6 months ago #142086
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Regarding setting cron job
What was the result of executing
"php /path/to/domain/public_html/application/controllers/cron/testcron" from the commandline?
You can check if php ins running from cli via e.g.
php -i > phpinfo.txt
"php /path/to/domain/public_html/application/controllers/cron/testcron" from the commandline?
You can check if php ins running from cli via e.g.
php -i > phpinfo.txt
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
- bava
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
7 years 6 months ago #142090
by bava
Replied by bava on topic Regarding setting cron job
i didn't check this by command line , for testing purpose i am creating a text file , by entering url like
www.xyz.com/controller/action
is working fine.
but when i trying by crontab it won't work
but when i trying by crontab it won't work
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
7 years 6 months ago #142091
by jelo
But since you use php with crontab you are executing via commandline.
To check that, you can execute "php /path/to/domain/public_html/application/controllers/cron/testcron" from the commandline and see if that runs without a glitch. If that works fine, start with crontab.If not, the issue is not with crontab.
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Regarding setting cron job
Well if you want a behaviour like accessing via a Webbrowser you should try curl instead of php as a command.bava wrote: i didn't check this by command line , for testing purpose i am creating a text file , by entering url like www.xyz.com/controller/action is working fine.
But since you use php with crontab you are executing via commandline.
To check that, you can execute "php /path/to/domain/public_html/application/controllers/cron/testcron" from the commandline and see if that runs without a glitch. If that works fine, start with crontab.If not, the issue is not with crontab.
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
7 years 6 months ago #142464
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Regarding setting cron job
We have a plugin system for this :
manual.limesurvey.org/Cron
Exemple of usage : github.com/SondagesPro/LS-sendMailCron
Denis
Exemple of usage : github.com/SondagesPro/LS-sendMailCron
Denis
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
7 years 6 months ago #142500
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Regarding setting cron job
How does the plugin system solve the issue with crontab not executing the php script?DenisChenu wrote: We have a plugin system for this : manual.limesurvey.org/Cron
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
- LouisGac
- Visitor
7 years 6 months ago - 7 years 6 months ago #142575
by LouisGac
Replied by LouisGac on topic Regarding setting cron job
well, the reason why your code doesn't work is because LimeSurvey doesn't strictly respect the Yii way of doing, in this case, the routing system (and plugin system make the problem even worst, because plugins doesn't extend any of the Yii classes, and their routing is a true horror).
In one of the future LS major release, this will be fixed, so it will be possible to modify LimeSurvey following the excellent Yii documentation (and to serve Yii module as LimeSurvey plugins).
For now, if you want to add a new controller with new actions, I'd suggest you to have a look how I did it for the home page setting:
github.com/LimeSurvey/LimeSurvey/blob/ma...homepagesettings.php
github.com/LimeSurvey/LimeSurvey/blob/ma...nController.php#L206
In one of the future LS major release, this will be fixed, so it will be possible to modify LimeSurvey following the excellent Yii documentation (and to serve Yii module as LimeSurvey plugins).
For now, if you want to add a new controller with new actions, I'd suggest you to have a look how I did it for the home page setting:
github.com/LimeSurvey/LimeSurvey/blob/ma...homepagesettings.php
github.com/LimeSurvey/LimeSurvey/blob/ma...nController.php#L206
Last edit: 7 years 6 months ago by LouisGac.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
7 years 6 months ago #142578
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Regarding setting cron job
@LouisGac :
@bava : see en.wikipedia.org/wiki/Cron
I make the same error ....bava wrote: hi,
.... adding a controller like CronController is not working, ....
bava wrote: ..... how to write a crontab command in linux.
@bava : see en.wikipedia.org/wiki/Cron
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.