handle signals and dump log periodically