Can't detach child process when main process is started from systemd

后端 未结 2 681
谎友^
谎友^ 2020-12-01 14:56

I want to spawn long-running child processes that survive when the main process restarts/dies. This works fine when running from the terminal:

$ cat exectest         


        
2条回答
  •  误落风尘
    2020-12-01 15:21

    If you cannot (like me) to change the KillMode of the service for some reason, you could try the at command (see man).

    You can schedule your command to run 1 minute ahead. See an example:

    # this will remove all .tmp files from "/path/" in 1 minute ahead (this task will run once)
    echo rm /path/*.tmp | at now + 1 minute
    

提交回复
热议问题