Page Menu
Home
ClusterLabs Projects
Search
Configure Global Search
Log In
Files
F2825358
cluster-clean
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
cluster-clean
View Options
#!/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;;
--kill-only) kill=2; 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 != 0 ]; 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
if [ $kill == 2 ]; then
exit 0
fi
fi
#logrotate -f $cluster_rotate
echo "Cleaning files"
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/lib/pacemaker -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"
File Metadata
Details
Attached
Mime Type
text/x-shellscript
Expires
Sat, Jan 25, 12:19 PM (20 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1322536
Default Alt Text
cluster-clean (2 KB)
Attached To
Mode
rP Pacemaker
Attached
Detach File
Event Timeline
Log In to Comment