How to have a Shell script continue after reboot?

前端 未结 3 718
野的像风
野的像风 2020-12-20 07:14

I have a Shell script that needs to run in a loop, and perform a series of commands, and when it\'s finished repeat, hence the loop. Between each command there is a sleep co

3条回答
  •  眼角桃花
    2020-12-20 08:08

    MySQL sounds like a pretty complex solution for this case. In general I would think about some sort of filesystem based markers. You could keep the current state of execution in one or more files e. g. in /var/run and make your script check for these files when it starts up.

    When you complete one step, you rename the file to reflect the next step that needs to be done and so on.

    At the end, rename it or remove it so that the next time the script runs, it will start a new cycle.

提交回复
热议问题