-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchangesnmp.sh
More file actions
executable file
·53 lines (52 loc) · 1.21 KB
/
changesnmp.sh
File metadata and controls
executable file
·53 lines (52 loc) · 1.21 KB
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
#!/bin/bash
PS3='Please select your datacenter: '
options=("SisGroup, Sidney, Australia" "Telepoint, Sofia, Bulgaria" "Ancient Media, Sofia, Bulgaria" "Pulsant, Maidenhead, UK" "SteadFast, Chicago, USA" "Amazon Web Services" "Unknown" "Type in")
select opt in "${options[@]}"
do case $opt in
"${options[0]}")
echo "Setting ${options[0]}"
DATACENTER=${options[0]}
break
;;
"${options[1]}")
echo "Setting ${options[1]}"
DATACENTER=${options[1]}
break
;;
"${options[2]}")
echo "Setting ${options[2]}"
DATACENTER=${options[2]}
break
;;
"${options[3]}")
echo "Setting ${options[3]}"
DATACENTER=${options[3]}
break
;;
"${options[4]}")
echo "Setting ${options[4]}"
DATACENTER=${options[4]}
break
;;
"${options[5]}")
echo "Setting ${options[5]}"
DATACENTER=${options[5]}
break
;;
"${options[6]}")
echo "Setting ${options[6]}"
DATACENTER=${options[6]}
break
;;
"${options[7]}")
echo "Setting ${options[7]}"
read DATACENTER
break
;;
*) echo invalid option;;
esac
done
PASSWD=`dd if=/dev/urandom count=1 2> /dev/null | md5sum | cut -c-26`
sed -e s/PAROLA/"${PASSWD}"/g snmpd.conf > snmpd.conf-new
sed -ie s/DATACENTER/"${DATACENTER}"/g snmpd.conf-new
rm snmpd.conf-newe