add posix signal listener for switching modes