Under Linux, crontab is executed repeatedly at the same time

 

Phenomenon: The program is executed twice after a single crontab is triggered. Check that the cron is not repeatedly defined, which is considered to be a natural disaster and a man-made disaster.

 

solve:

  1. Restart the crontab service: /etc/init.d/crond restart, all right? I tried without success, so, try option 2 !
  2. Restart the server: reboot

The above is taken from the solution of others. The solution of our project is to migrate to the timed task of java spring.

Another thing to pay attention to is the dirty reading of data, because the data error caused by repeated triggering also needs to consider whether there is the possibility of other transactions concurrency in the business scenario, and add optimistic locking to avoid the generation of wrong data.

Phenomenon: The program is executed twice after a single crontab is triggered. Check that the cron is not repeatedly defined, which is considered to be a natural disaster and a man-made disaster.

 

solve:

  1. Restart the crontab service: /etc/init.d/crond restart, all right? I tried without success, so, try option 2 !
  2. Restart the server: reboot

The above is taken from the solution of others. The solution of our project is to migrate to the timed task of java spring.

Another thing to pay attention to is the dirty reading of data, because the data error caused by repeated triggering also needs to consider whether there is the possibility of other transactions concurrency in the business scenario, and add optimistic locking to avoid the generation of wrong data.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327073680&siteId=291194637