diff --git a/extra/cluster-clean b/extra/cluster-clean index 75e92bed41..f7b4a83182 100755 --- a/extra/cluster-clean +++ b/extra/cluster-clean @@ -1,69 +1,78 @@ #!/bin/bash hosts= group= kill=0 while true; do case "$1" in -x) set -x; shift;; -w) for h in $2; do hosts="$hosts -w $h"; done shift; shift;; -g) group=$2; shift; shift;; --kill) kill=1; shift;; "") break;; *) echo "unknown option: $1"; exit 1;; esac done if [ x"$group" = x -a x"$hosts" = x ]; then group=$CTS_GROUP fi if [ x"$hosts" != x ]; then echo `date` ": Cleaning up hosts:" target=$hosts elif [ x"$group" != x ]; then echo `date` ": Cleaning up group: $group" target="-g $group" else echo "You didn't specify any nodes to clean up" exit 1 fi cluster-helper --list bullet $target if [ $kill = 1 ]; then echo "Cleaning processes" cluster-helper $target -- "killall -q -9 corosync aisexec heartbeat pacemakerd ccm stonithd ha_logd lrmd crmd pengine attrd pingd mgmtd cib fenced dlm_controld gfs_controld" &> /dev/null # Bah. Force systemd to actually look at the process and realize its dead" cluster-helper $target -- "service corosync stop" &> /dev/null cluster-helper $target -- "service pacemaker stop" &> /dev/null fi #logrotate -f $cluster_rotate echo "Cleaning files" -files="" -files="$files /dev/shm/qb-*" -files="$files /var/lib/heartbeat/crm/cib-*" -files="$files /var/lib/heartbeat/cores/*/core.*" -files="$files /var/lib/heartbeat/hostcache" -files="$files /var/lib/openais/core.*" -files="$files /var/lib/corosync/core.*" -files="$files /var/lib/oprofile/samples/cts.*" -files="$files /var/log/messages*" -files="$files /var/log/localmessages*" -files="$files /var/log/cluster*.log" -files="$files /var/log/corosync.log" -files="$files /var/log/pacemaker.log" -files="$files var/run/crm/blackbox*" -cluster-helper $target -- "rm -f $files" -cluster-helper $target -- "find /var/lib/pengine -name '*.bz2' -exec rm -f \{\} \;" +log_files="" +log_files="$log_files 'messages*'" +log_files="$log_files 'localmessages*'" +log_files="$log_files 'cluster*.log'" +log_files="$log_files corosync.log" +log_files="$log_files pacemaker.log" + +state_files="" +state_files="$state_files 'cib-*'" +state_files="$state_files 'core.*'" +state_files="$state_files hostcache" +state_files="$state_files 'cts.*'" +state_files="$state_files 'pe*.bz2'" + +for f in $log_files; do + cluster-helper $target -- "find /var/log -name '$f' -exec rm -f \{\} \;" +done + +for f in $state_files; do + cluster-helper $target -- "find /var/lib -name '$f' -exec rm -f \{\} \;" +done + +cluster-helper $target -- "find /dev/shm -name 'qb-*' -exec rm -f \{\} \;" +cluster-helper $target -- "find /var/run/crm -name 'blackbox*' -exec rm -f \{\} \;" cluster-helper $target -- "find /tmp -name 'cts-*.valgrind' -exec rm -f \{\} \;" + cluster-helper $target -- service rsyslog restart 2>&1 > /dev/null cluster-helper $target -- logger -i -p daemon.info __clean_logs__ #touch $cluster_log echo `date` ": Clean complete"