#!/bin/bash
# check that puppet is running and start it if it's not
hostname
EXIT=0
if ! ps -ef | grep pup*et; then
  echo "puppet is not running on $HOSTNAME -- restarting"
  # try to restart
  /usr/bin/ruby /usr/sbin/puppetd --server=volt1 || EXIT=1
  if ! ps -ef | grep pup*et; then
    echo "puppet is still not running on $HOSTNAME"
    EXIT=1
  fi
fi

cd /tmp && ls -tr | grep volt_snapshot | head -n-10 | xargs rm -f

exit $EXIT

#!/bin/bash
# check that puppet is running and start it if it's not
EXIT=0
if ! ps -ef | grep pup*et; then
  echo "puppet is not running on $HOSTNAME -- restarting"
  # try to restart
  /usr/bin/ruby /usr/sbin/puppetd --server=volt1 || EXIT=1
  if ! ps -ef | grep pup*et; then
    echo "puppet is still not running on $HOSTNAME"
    EXIT=1
  fi
fi

cd /tmp && ls -tr | grep volt_snapshot | head -n-10 | xargs rm

exit $EXIT

--- 
+++ 
@@ -1,5 +1,6 @@
 #!/bin/bash
 # check that puppet is running and start it if it's not
+hostname
 EXIT=0
 if ! ps -ef | grep pup*et; then
   echo "puppet is not running on $HOSTNAME -- restarting"
@@ -11,6 +12,6 @@
   fi
 fi
 
-cd /tmp && ls -tr | grep volt_snapshot | head -n-10 | xargs rm
+cd /tmp && ls -tr | grep volt_snapshot | head -n-10 | xargs rm -f
 
 exit $EXIT
Remove confusing output when no snapshot files need to be removed
Output which machine is being checked, for easier diagnosis

