-
Notifications
You must be signed in to change notification settings - Fork 0
/
main
executable file
·65 lines (58 loc) · 1.47 KB
/
main
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
#!/bin/bash
which gdialog 2> /dev/null && DIALOG=gdialog || DIALOG=dialog
pyVersion=`which python`
if [ $pyVersion != "" ]
then
echo "Python installed"
pid=`ps -ef | grep rest_forward | awk '{ print $2 }'`
echo "Rest_forward running in background with process id : "
echo $pid
else
echo "Python not found"
exit
fi
end () {
exit
}
printDialog () {
while true
do
cmd=($DIALOG --keep-tite --menu "Select channel :" 11 30 16)
options=(1 "Unencrypted"
2 "Encrypted")
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
for choice in $choices
do
case $choice in
1)
disable=`curl -s -o /dev/null -I -w "%{http_code}" -X GET http://localhost:8080/channel/1/1`
if [ $disable -gt 199 -a $disable -lt 299 ]
then
display="Encryption Disabled! To change option please select yes"
else
display="Issue contacting server. Please check if server is running and try again"
fi
;;
2)
enable=`curl -s -o /dev/null -I -w "%{http_code}" -X GET http://localhost:8080/channel/1/2`
if [ $enable -gt 199 -a $enable -lt 299 ]
then
display="Encryption Enabled! To change option please select yes"
else
display="Issue contacting server. Please check if server is running and try again"
fi
;;
esac
$DIALOG --yesno "$display" 10 25 || end
done
done
}
dialogCheck=`which dialog`
if [ $dialogCheck != "" ]
then
printDialog
else
echo "Dialog not installed"
`sudo yum install -y dialog`
printDialog
fi