IMPALA-9241: Remove pid files on successful shutdown of minicluster

The minicluster init scripts currently keep track of pids
for HDFS, YARN, etc by writing the pid to files for each
service. It uses the pid in the file to see what is running and
needs to shutdown or start. Currently, it does not remove the pid
file after the minicluster shuts down. This means that it would
be reading a zombie pid from the pid file to see if the service
is already running. If the pid is reused by something else, it
can fail to start up a necessary service.

This removes the pid files when the minicluster components shut down
successfully.

Change-Id: I5b14d74df8061b6595b9897df9c9667e3f569e34
Reviewed-on: http://gerrit.cloudera.org:8080/14950
Reviewed-by: Andrew Sherman <asherman@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
diff --git a/testdata/cluster/node_templates/common/etc/init.d/common.tmpl b/testdata/cluster/node_templates/common/etc/init.d/common.tmpl
index 51197c5..525ffdb 100644
--- a/testdata/cluster/node_templates/common/etc/init.d/common.tmpl
+++ b/testdata/cluster/node_templates/common/etc/init.d/common.tmpl
@@ -80,6 +80,8 @@
   local DEADLINE=$(($(date +%s) + $TIMEOUT_SECS))
   while [[ $(date +%s) -lt $DEADLINE ]]; do
     if ! pid_exists $PID; then
+      # Remove the pid file so that there is no confusion if the pids wrap
+      rm -f $PID_FILE
       return
     fi
     sleep 0.1