Introduction
When there is a small server at home, it is necessary to perform some scheduled tasks
operate
- cronjob
In the beginning, my scheduled tasks should use cronjob like everyone else, but cronjob can not intuitively display the execution of each scheduled task, and the alarm after the implementation of the scheduled task fails is a little complicated.
- Scheduled task management tool
So, I used the timed task management tool
I just started using xxl-job, which is also the most used, simple and convenient. The disadvantage is that it is written in java, and the memory usage is actually a bit large for a small server. After all, we only want to achieve the effect of timed tasks. The same product also have powerjob
- awx
After that, awx was used. Based on ansible, all configurations can be managed by git. There is no problem in regularly backing up mysql or executing scripts. One this thing is not what I want
- kubernetes cronjob
Then I use kubernetes’ cronjob to perform scheduled tasks. Yes, it is getting more and more advanced, but every time a scheduled task is executed, a pods must be started. When your scheduled task script needs to be modified, you modify it. There are more places. More importantly, my k8s is built on the Raspberry Pi, so in order to prolong the use time of my USB disk as much as possible, I decided not to use this.
- drone ci
In the end, I found that it is best to use the ci tool to run timed tasks regularly. First, you can start multiple runners to run your timed tasks concurrently. Secondly, all your timed task-related scripts use git. Go to managed, you can easily roll back
There is also a log for each timed task running, which can be easily viewed, and can be perfectly alerted after failure. At the same time, you can easily modify and verify your timed task script. More importantly, I use drone ci to compile all my code and publish my blog. For me, I don’t need to add new resources.
Except that you need to know the relevant knowledge of ci, the threshold is a little high. Other than that, I don’t think there are any major drawbacks.
Welcome to my blog www.bboy.app
Have Fun
This article is reproduced from: https://www.bboy.app/2022/05/10/%E8%AF%B4%E4%B8%80%E8%AF%B4%E6%88%91%E7%9A%84% E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1%E7%AE%A1%E7%90%86/
This site is for inclusion only, and the copyright belongs to the original author.