How to stop heartbeat service rather using kill command?
I do it, basically delegate the task to a process control system like http://supervisord.org/index.html
You create the config file for the process:
[program:foo]command=/bin/cat
and then you will start/stop like supervisordctl stop foo
supervisor will do the job depending on the configs you set in the supervisor.conf. Other advantages if that the program crashes due to a critic error, it will be automatically started if you configured in the file to do so.