Prevent job from double execution
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Expert
- Posts: 274
- Joined: 27 Jun 2019, 16:19
Prevent job from double execution
Good night, community !
Having a problem. I have created custom job as described here https://aimeos.org/docs/2020.x/cronjobs ... ontroller/
I tell me, please, do you know good solution, how to prevent my job from being executed several times simulationasly ?
For example I will add my job to cron which run each 1 minute. But what if started job has not finished yet ? I don't want this task to be executed, to say exactly - it may be executed, but need to detect that this task is running and prevent to perform the job...
Just realized, maybe it is not aimeos related question. So if I set cron like:
how it works? Will it execute in 1 minutes if one of jobs is not finished ? - I just checked this, crontask keeps opening jobs...
Is it considered on standard aimeos jobs like ??
Aimeos components versions:
Thanks!
Having a problem. I have created custom job as described here https://aimeos.org/docs/2020.x/cronjobs ... ontroller/
I tell me, please, do you know good solution, how to prevent my job from being executed several times simulationasly ?
For example I will add my job to cron which run each 1 minute. But what if started job has not finished yet ? I don't want this task to be executed, to say exactly - it may be executed, but need to detect that this task is running and prevent to perform the job...
Just realized, maybe it is not aimeos related question. So if I set cron like:
Code: Select all
`* * * * * php /var/www/schmuck/artisan aimeos:jobs "order/email/delivery order/email/payment order/email/voucher order/service/delivery"`
Is it considered on standard aimeos jobs like
Code: Select all
order/email/delivery order/email/payment order/email/voucher order/service/delivery
Aimeos components versions:
Code: Select all
aimeos/ai-admin-jqadm 2019.10.6 Aimeos ai-admin-jqadm extension
aimeos/ai-admin-jsonadm 2019.10.2 Aimeos ai-admin-jsonadm extension
aimeos/ai-client-html 2019.10.10 Aimeos ai-client-html extension
aimeos/ai-client-jsonapi 2019.10.2 Aimeos JSON API extension
aimeos/ai-controller-frontend 2019.10.3 Aimeos ai-controller-frontend extension
aimeos/ai-controller-jobs 2019.10.4 Aimeos ai-controller-jobs extension
aimeos/ai-gettext 2019.10.1 Aimeos Gettext extension
aimeos/ai-laravel 2019.10.2 Laravel adapter for Aimeos web shops and e-commerce solutions
aimeos/ai-payments 2019.10.1 Payment extension for Aimeos web shops and e-commerce solutions
aimeos/ai-swiftmailer 2019.10.1 SwiftMailer adapter for Aimeos web shops and e-commerce solutions
aimeos/aimeos-core 2019.10.7 Full-featured e-commerce components for high performance online shops
aimeos/aimeos-laravel 2019.10.1 Professional, full-featured and high performance Laravel e-commerce package for online shops and complex B2B projects
Thanks!
Re: Prevent job from double execution
You can create a shell script like this one:
It tests if the "aimeos.lock" file exists and executes the jobs otherwise
Code: Select all
#!/bin/bash
if [ ! -f aimeos.lock ]; then
touch aimeos.lock
php /var/www/schmuck/artisan aimeos:jobs "order/email/delivery order/email/payment order/email/voucher order/service/delivery"
rm aimeos.lock
fi
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,
