added shutdown hook. added generation of running_pid file
merged stop methods