Skip to content
Advertisement

How to stop PHP cron job after 30 minutes from sh file

I’m running a php yii2 cron from cronjob through a sh file every minute, so if previous job doesn’t complete within a minute so it won’t execute more than 1 time. But my problem is that, it got stuck some time and i have to manually kill this process. How can i kill a cronjob if it running from past 30 minutes. Currently my sh file is like below:

JavaScript

Advertisement

Answer

I write a test . Use check_test_demo.sh to detect test_demo.sh

JavaScript
JavaScript

answer, I don’t know if it’s right. You can try. I think you should record the start time of a process first

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement