Created a function to save state of runtime variables
Run save state on SIGUSR1 as well as periodically.