I have imapfilter on a cronjob. Since the relevant Exchange server supports IDLE, I write a PID file on launch. The config file checks if the process is alive, and if it is quits, otherwise it updates the PID file.
I now want to make imapfilter restart on configuration changes. All I need to do is checksum the current configuration file every once in a while, and if it changes... well, what then?
I could just quit and wait for cron to bring the process back up, but that doesn't help me when tweaking the rules.
I'd rather use something like exec(3)
, but it is most likely that I cannot do the necessary cleanup from a mere configuration file. Also I have no idea how to actually call exec
from Lua; all Google searches point to os.execute()
, which waits for the child process to quit.
Is there a saner approach to cause the process to restart? Portability is not a concern, sorry.