TERM signals and graceful shutdown

Hey everyone!

I am trying to write a sort of daemon that keeps track of files and updates a database backend whenever something changes. This will be run in a docker container. Although i don't think it is crucial, it would be nice to be able to "tidy up" things whenver the container terminates. Terminating a Docker container with ex. Docker kill sends the TERM signal to the container process, e.g my daemon. The question is, is there a way to check for this signal in R and do a little cleanup before exiting?


Have you looked at the processx package?

callr also deals with background R processes, though I'm not sure if that's relevant here:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.