File: ganglia-hosts-lowercase.sh

package info (click to toggle)
ganglia 3.6.0-7
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 6,484 kB
  • ctags: 3,880
  • sloc: ansic: 27,874; sh: 11,052; python: 6,695; makefile: 565; perl: 366; php: 126; xml: 28
file content (27 lines) | stat: -rw-r--r-- 708 bytes parent folder | download | duplicates (4)
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
#!/bin/bash

# This script renames all the host directory names to lowercase
# It is part of a solution to the case-sensitive hostname problem,
# bug 232, http://bugzilla.ganglia.info/cgi-bin/bugzilla/show_bug.cgi?id=232

# RRDROOT must be set to the location where RRD files are kept

#RRDROOT=/var/lib/ganglia/rrds

if [ -z "${RRDROOT}" ];
then
  echo Please specify RRDROOT
  exit 1
fi

killall gmetad
cd $RRDROOT || exit 1
find . -type d -name '*[A-Z]*' ! -name __SummaryInfo__ -mindepth 2 -maxdepth 2 | while read ;
do
  OLD_NAME=`echo "$REPLY" | cut -f3 -d/`
  NEW_NAME=`echo "$OLD_NAME" | tr [A-Z] [a-z]`
  CLUSTER_NAME=`echo "$REPLY" | cut -f2 -d/`
  mv "$REPLY" "${CLUSTER_NAME}/${NEW_NAME}"
done