blob: 4b75edf279bdda4abc5df1ffc2eb2f1744b99991 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
#!@BASH_PATH@
#
# Copyright 2011-2023 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
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"
# Bah. Force systemd to actually look at the process and realize it's dead
cluster-helper $target -- "service corosync stop" &> /dev/null &
cluster-helper $target -- "service pacemaker stop" &> /dev/null &
cluster-helper $target -- "killall -q -9 corosync pacemakerd pacemaker-attrd pacemaker-based pacemaker-controld pacemaker-execd pacemaker-fenced pacemaker-remoted pacemaker-schedulerd dlm_controld gfs_controld" &> /dev/null
cluster-helper $target -- 'kill -9 `pidof valgrind`' &> /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*'"
log_files="$log_files '*.journal'"
log_files="$log_files '*.journal~'"
log_files="$log_files 'secure-*'"
state_files=""
state_files="$state_files 'cib.xml*'"
state_files="$state_files 'valgrind-*'"
state_files="$state_files 'cib-*'"
state_files="$state_files 'core.*'"
state_files="$state_files 'cts.*'"
state_files="$state_files 'pe*.bz2'"
state_files="$state_files 'fdata-*'"
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 @CRM_BLACKBOX_DIR@ -name '*-*' -exec rm -f \{\} \;"
cluster-helper $target -- "find /tmp -name '*.valgrind' -exec rm -f \{\} \;"
cluster-helper $target -- 'service rsyslog restart' > /dev/null 2>&1
cluster-helper $target -- 'systemctl restart systemd-journald.socket' > /dev/null 2>&1
cluster-helper $target -- logger -i -p daemon.info __clean_logs__
#touch $cluster_log
echo `date` ": Clean complete"
|