As a preface, I've got a python script running flask being served by gunicorn running as a service. One command this service takes is a long running function that runs anywhere from 5-10 minutes. When the gunicorn service receives a SIGTERM it waits 10 minutes, then kills itself, this way the long running process can continue.
The current action on restart is it waits 10 minutes, kills the current process, then starts a new one.
What I'd like to do on restart is send a SIGUSR2 to the current service to start a new one, then send the SIGTERM to end the old one.
I believe an alternative to all this would be to manually send the SIGUSR2 and SIGTERM signals then update the running service's PID to the new one? I'm not totally sure what my best options are here.