search

Home  >  Q&A  >  body text

linux - How to write a background process or daemon process that does not time out or a cron process that is executed after a few hours

It is known that a TTL ranges from 2 hours to 100 hours. I plan to write a script to execute another script after the TTL to implement a standby process. At first I wanted to use cron to implement it, but how to convert the given TTL into a cron expression for a specific date is a very complicated process that is difficult to implement perfectly.

So I thought of using & background execution process or using daemon daemon process , sleep TTL hours, and then execute another sh script. But it seems that because the TTL is too long, the system determines that the process has timed out. When I used 1 hour for testing, the second script would not be executed. I would like to ask you guys, how do you check the timeout period of the Linux system you are using?

In addition, how should I better implement the function of my script that is on standby?

世界只因有你世界只因有你2708 days ago835

reply all(1)I'll reply

  • 三叔

    三叔2017-06-21 10:14:10

    If your system uses systemd, you can use its timer systemd.timer to complete your needs. For details, please refer to /a/11...

    reply
    0
  • Cancelreply