Revision 2958c56e daemons/ganeti-cleaner.in
b/daemons/ganeti-cleaner.in | ||
---|---|---|
26 | 26 |
: ${CHECK_CERT_EXPIRED:=$PKGLIBDIR/check-cert-expired} |
27 | 27 |
|
28 | 28 |
readonly CLEANER_LOG_DIR=$LOG_DIR/cleaner |
29 |
readonly QUEUE_ARCHIVE_DIR=$DATA_DIR/queue/archive |
|
30 | 29 |
readonly CRYPTO_DIR=$RUN_DIR/crypto |
31 | 30 |
|
32 | 31 |
in_cluster() { |
33 | 32 |
[[ -e $DATA_DIR/ssconf_master_node ]] |
34 | 33 |
} |
35 | 34 |
|
36 |
cleanup_master() { |
|
37 |
# Return if machine is not part of a cluster |
|
38 |
in_cluster || return 0 |
|
39 |
|
|
40 |
# Return if queue archive directory doesn't exist |
|
41 |
[[ -d $QUEUE_ARCHIVE_DIR ]] || return 0 |
|
42 |
|
|
43 |
# Remove old jobs |
|
44 |
find $QUEUE_ARCHIVE_DIR -mindepth 2 -type f -mtime +$REMOVE_AFTER -print0 | \ |
|
45 |
xargs -r0 rm -vf |
|
46 |
} |
|
47 |
|
|
48 | 35 |
cleanup_node() { |
49 | 36 |
# Return if directory for crypto keys doesn't exist |
50 | 37 |
[[ -d $CRYPTO_DIR ]] || return 0 |
... | ... | |
90 | 77 |
find $CLEANER_LOG_DIR -maxdepth 1 -type f | sort | head -n -$KEEP_LOGS | \ |
91 | 78 |
xargs -r rm -vf |
92 | 79 |
|
93 |
cleanup_master |
|
94 | 80 |
cleanup_node |
95 | 81 |
cleanup_watcher |
96 | 82 |
|
Also available in: Unified diff