[162] | 1 | #!/bin/bash |
---|
| 2 | # Program: |
---|
| 3 | # NutchEz management interface |
---|
| 4 | # Author: |
---|
| 5 | # Waue, Shunfa, Rock {waue, shunfa, rock}@nchc.org.tw |
---|
| 6 | # Version: |
---|
| 7 | # 1.0 |
---|
| 8 | # History: |
---|
| 9 | # 2010/06/07 Rock First release (1.0) |
---|
| 10 | |
---|
[172] | 11 | # [Variables Declaration] # |
---|
[186] | 12 | DIALOG="dialog" |
---|
[162] | 13 | main_choice= |
---|
[186] | 14 | lang= |
---|
[162] | 15 | |
---|
[172] | 16 | # [PATH Declaration] # |
---|
[186] | 17 | NutchEZ_Install_PATH="/opt/nutchez" |
---|
| 18 | Tomcat_HOME="/opt/nutchez/tomcat" |
---|
| 19 | NutchEZ_HOME="/home/nutchuser/nutchez" |
---|
[194] | 20 | Work_Path=$(echo $0 | sed 's/client_install//') |
---|
[171] | 21 | |
---|
[186] | 22 | # [Env Declaration] # |
---|
[194] | 23 | . $Work_Path/lang_en_US_nutchez |
---|
[186] | 24 | |
---|
[172] | 25 | # [Functions Declaration] # |
---|
[186] | 26 | ## [Pre-check for language] ## |
---|
| 27 | function prepare_lang(){ |
---|
| 28 | lang=$(locale | grep 'LANG=' | cut -d "=" -f2) |
---|
| 29 | |
---|
| 30 | # if lang=zh then source lang_zh_TW_nutchez |
---|
[194] | 31 | echo $lang | grep 'zh' && source $Work_Path/lang_zh_TW_nutchez |
---|
[186] | 32 | } |
---|
| 33 | |
---|
| 34 | |
---|
| 35 | ## [Pre-Check for nutch_nodes file] ## |
---|
[162] | 36 | function prepare_check(){ |
---|
[172] | 37 | # 若無 nutchez_nodes 則跳出 |
---|
| 38 | if [ ! -e "${NutchEZ_HOME}/system/nutch_nodes" ]; then |
---|
[186] | 39 | $DIALOG --clear --backtitle "$dia_back" --title "$dia_pre_check_title_1" \ |
---|
| 40 | --msgbox "$dia_pre_check_msg_1 $NutchEZ_HOME/system/nutch_nodes !!!" 10 40 |
---|
[162] | 41 | exit |
---|
| 42 | fi |
---|
| 43 | |
---|
[172] | 44 | # 判斷 nutch_nodes 和 nutch_nodes.back |
---|
| 45 | # 第一次執行則要求 user 更新 /etc/hosts |
---|
| 46 | if [ ! -e "${NutchEZ_HOME}/system/nutch_nodes.bak" ]; then |
---|
[186] | 47 | $DIALOG --clear --backtitle "$dia_back" --title "$dia_pre_check_title_2" \ |
---|
| 48 | --yesno "$dia_pre_check_yesno_1\n$dia_pre_check_yesno_2" 10 55 |
---|
[162] | 49 | |
---|
[186] | 50 | echo -e "$pre_check_echo_1" |
---|
[172] | 51 | ./duplicate_del "${NutchEZ_HOME}/system/nutch_nodes" |
---|
| 52 | su root -c "./duplicate_del /etc/hosts && ./add_hosts ${NutchEZ_HOME}/system/nutch_nodes /etc/hosts" |
---|
| 53 | # 若密碼輸入失敗則跳出 |
---|
| 54 | if [ $? == "1" ]; then |
---|
[186] | 55 | echo "$pre_check_echo_2" |
---|
[172] | 56 | exit |
---|
| 57 | fi |
---|
| 58 | # 若 nutch_nodes 被更新過,則要求更新 /etc/hosts |
---|
| 59 | elif [ ${NutchEZ_HOME}/system/nutch_nodes -nt ${NutchEZ_HOME}/system/nutch_nodes.bak ]; then |
---|
[186] | 60 | $DIALOG --clear --backtitle "$dia_back" --title "$dia_pre_check_title_2" \ |
---|
| 61 | --yesno "$dia_pre_check_yesno_3\n$dia_pre_check_yesno_2" 10 55 |
---|
[165] | 62 | |
---|
[186] | 63 | echo -e "$pre_check_echo_1" |
---|
[172] | 64 | ./duplicate_del "${NutchEZ_HOME}/system/nutch_nodes" |
---|
| 65 | su root -c "./duplicate_del /etc/hosts && ./add_hosts ${NutchEZ_HOME}/system/nutch_nodes /etc/hosts" |
---|
| 66 | # 若密碼輸入失敗則跳出 |
---|
| 67 | if [ $? == "1" ]; then |
---|
[186] | 68 | echo "$pre_check_echo_2=" |
---|
[172] | 69 | exit |
---|
| 70 | fi |
---|
| 71 | fi |
---|
[162] | 72 | } |
---|
| 73 | |
---|
[172] | 74 | ## [Main Menu] ## |
---|
[162] | 75 | function main_menu(){ |
---|
| 76 | main_choice="/tmp/main_choice" |
---|
| 77 | |
---|
[186] | 78 | $DIALOG --clear --backtitle "$dia_back" \ |
---|
| 79 | --title "$dia_main_title_1" \ |
---|
| 80 | --menu "$dia_choose" 15 60 7 \ |
---|
| 81 | "cluster_status" "$dia_main_menu_1_1" \ |
---|
| 82 | "cluster_setup" "$dia_main_menu_1_2" \ |
---|
| 83 | "server_setup" "$dia_main_menu_1_3" \ |
---|
| 84 | "tomcat_switch" "$dia_main_menu_1_4" \ |
---|
| 85 | "tomcat_port" "$dia_main_menu_1_5" \ |
---|
| 86 | "lang_switch" "$dia_main_menu_1_6" \ |
---|
| 87 | "exit" "$dia_exit" 2>$main_choice |
---|
[162] | 88 | } |
---|
| 89 | |
---|
[174] | 90 | ## [Cluster Status (datanode & tasktracker)] ## |
---|
| 91 | function cluster_status(){ |
---|
| 92 | IP_list=$(cat $NutchEZ_HOME/system/nutch_nodes | grep -v '^$' | grep -v '#' | awk '{print $1}') |
---|
| 93 | clusterStatus="/tmp/clusterStatus" |
---|
| 94 | rm $clusterStatus 2> /dev/null |
---|
| 95 | #printf '%16s\t %11s\t %10s\t %25s\n' "[IP] [Hostanme] [Network] [Dtatnode & Tasktracker]" >>$clusterStatus |
---|
[186] | 96 | echo -e "$cluster_status_echo_1" >>$clusterStatus |
---|
[174] | 97 | echo -e "------------------------------------------------------------------------" >>$clusterStatus |
---|
[186] | 98 | echo -e "\n$cluster_status_echo_2" |
---|
[174] | 99 | for ip in $IP_list |
---|
| 100 | do |
---|
| 101 | # Check Network status |
---|
| 102 | ip_status="online" |
---|
| 103 | ping -c1 -w1 $ip 2>&1 > /dev/null || ip_status="offline" |
---|
| 104 | # Check Hadoop/Nutch service through ssh |
---|
| 105 | Task_Data_status="stop" |
---|
| 106 | if [ $ip_status == "online" ]; then |
---|
| 107 | Task_Data=$(ssh -o StrictHostKeyChecking=no $ip "jps |grep TaskTracker ; jps | grep DataNode") |
---|
| 108 | fi |
---|
| 109 | |
---|
[175] | 110 | [ -z "$Task_Data" ] || Task_Data_status="running" |
---|
[174] | 111 | host_name=$(cat $NutchEZ_HOME/system/nutch_nodes | grep $ip | awk '{print $2}') |
---|
[186] | 112 | echo -e "$ip $host_name \t\t $ip_status \t $Task_Data_status" >>$clusterStatus |
---|
[174] | 113 | # printf '%16s\t %11s\t %10s\t %25s\n' "$ip $host_name $ip_status $Task_Data_status" >>$clusterStatus |
---|
| 114 | done |
---|
| 115 | |
---|
[186] | 116 | read -p "$cluster_status_read_1" |
---|
| 117 | $DIALOG --clear --backtitle "$dia_back" \ |
---|
| 118 | --title "$dia_cluster_status_title_1" --textbox $clusterStatus 20 90 |
---|
[174] | 119 | } |
---|
| 120 | |
---|
[183] | 121 | |
---|
[186] | 122 | ## [Server Setup (namenode & jobtracker)] ## |
---|
[183] | 123 | function server_setup(){ |
---|
| 124 | serverSetup=/tmp/serverSetup |
---|
| 125 | pid_name=$(jps | grep NameNode) |
---|
| 126 | pid_job=$(jps | grep JobTracker) |
---|
| 127 | |
---|
| 128 | if [ -z "$pid_name" -a -z "$pid_job" ]; then |
---|
[186] | 129 | $DIALOG --clear --backtitle "$dia_back" --title "$dia_server_title_1" \ |
---|
| 130 | --msgbox "$dia_server_msg_1" 7 50 |
---|
[183] | 131 | elif [ -z "$pid_name" -a -n "$pid_job" ]; then |
---|
[186] | 132 | $DIALOG --clear --backtitle "$dia_back" --title "$dia_server_title_1" \ |
---|
| 133 | --msgbox "$dia_server_msg_2" 7 50 |
---|
[183] | 134 | elif [ -n "$pid_name" -a -z "$pid_job" ]; then |
---|
[186] | 135 | $DIALOG --clear --backtitle "$dia_back" --title "$dia_server_title_1" \ |
---|
| 136 | --msgbox "$dia_server_msg_3" 7 50 |
---|
[183] | 137 | else |
---|
[186] | 138 | $DIALOG --clear --backtitle "$dia_back" --title "$dia_server_title_1" \ |
---|
| 139 | --msgbox "$dia_server_msg_4" 7 50 |
---|
[183] | 140 | fi |
---|
| 141 | |
---|
[186] | 142 | $DIALOG --clear --backtitle "$dia_back" --title "$dia_server_title_2" \ |
---|
| 143 | --menu "$dia_choose" 15 65 4 \ |
---|
| 144 | "start" "$dia_server_menu_1_1" \ |
---|
| 145 | "stop" "$dia_server_menu_1_2" \ |
---|
| 146 | "restart" "$dia_server_menu_1_3" \ |
---|
| 147 | "exit" "$dia_exit" 2>$serverSetup |
---|
[183] | 148 | |
---|
| 149 | if [ "$(cat $serverSetup)" == "start" ]; then |
---|
| 150 | $NutchEZ_Install_PATH/nutch/bin/start-dfs.sh |
---|
| 151 | $NutchEZ_Install_PATH/nutch/bin/start-mapred.sh |
---|
| 152 | elif [ "$(cat $serverSetup)" == "stop" ]; then |
---|
| 153 | $NutchEZ_Install_PATH/nutch/bin/stop-dfs.sh |
---|
| 154 | $NutchEZ_Install_PATH/nutch/bin/stop-mapred.sh |
---|
| 155 | elif [ "$(cat $serverSetup)" == "restart" ]; then |
---|
| 156 | $NutchEZ_Install_PATH/nutch/bin/stop-dfs.sh |
---|
| 157 | $NutchEZ_Install_PATH/nutch/bin/stop-mapred.sh |
---|
| 158 | $NutchEZ_Install_PATH/nutch/bin/start-dfs.sh |
---|
| 159 | $NutchEZ_Install_PATH/nutch/bin/start-mapred.sh |
---|
| 160 | else |
---|
| 161 | exit |
---|
| 162 | fi |
---|
| 163 | } |
---|
| 164 | |
---|
| 165 | |
---|
[172] | 166 | ## [Cluster Setup (datanode & tasktracker)] ## |
---|
[162] | 167 | function cluster_setup(){ |
---|
[172] | 168 | # 從 nutch_nodes 讀出 ip 和 hostname |
---|
| 169 | #IP_list=$(cat $NutchEZ_HOME/system/nutch_nodes | grep -v '^$' | grep -v '#' | awk '{print $1}') |
---|
| 170 | #HOST_list=$(cat $NutchEZ_HOME/system/nutch_nodes | grep -v '^$' | grep -v '#' | awk '{print $2}') |
---|
| 171 | LIST_status="off" |
---|
| 172 | allpart="/tmp/allpart" |
---|
| 173 | runNodes="/tmp/runNodes" |
---|
| 174 | clusterSetup="/tmp/clusterSetup" |
---|
[162] | 175 | |
---|
[186] | 176 | $DIALOG --clear --backtitle "$dia_back" \ |
---|
| 177 | --title "$dia_cluster_setup_title_1" \ |
---|
| 178 | --menu "$dia_choose" 15 55 3 \ |
---|
| 179 | "All" "$dia_cluster_setup_menu_1_1" \ |
---|
| 180 | "Part" "$dia_cluster_setup_menu_1_2" \ |
---|
| 181 | "Exit" "$dia_exit" 2>$allpart |
---|
[162] | 182 | |
---|
[172] | 183 | # 判斷是否選 all 和 part,若是 all 直接到服務選單,若是 part 則先到機器選單 |
---|
[177] | 184 | if [ "$(cat $allpart)" == "All" ]; then |
---|
[172] | 185 | cat $NutchEZ_HOME/system/nutch_nodes | grep -v '^$' | grep -v '#' | awk '{print $1}' >$runNodes |
---|
[177] | 186 | elif [ "$(cat $allpart)" == "Part" ]; then |
---|
[186] | 187 | $DIALOG --clear --backtitle "$dia_back" --title "$dia_cluster_setup_title_2" \ |
---|
| 188 | --checklist "$dia_cluster_setup_check_1" 15 55 7 $(cat $NutchEZ_HOME/system/nutch_nodes | \ |
---|
[172] | 189 | grep -v '^$' | grep -v '#' | awk '{print $1 "\t" $2 "\t" "$LIST_status" }') 2>$runNodes |
---|
[177] | 190 | else |
---|
| 191 | exit |
---|
[172] | 192 | fi |
---|
| 193 | |
---|
[177] | 194 | if [ -z "$(cat $runNodes)" ]; then |
---|
[180] | 195 | exit |
---|
| 196 | else |
---|
| 197 | $(cat $runNodes) | sed -i 's/"//g' $runNodes |
---|
[177] | 198 | fi |
---|
| 199 | |
---|
[186] | 200 | $DIALOG --clear --backtitle "$dia_back" --title "$dia_cluster_setup_title_3" \ |
---|
| 201 | --menu "$dia_choose" 15 65 4 \ |
---|
| 202 | "start" "$dia_cluster_setup_menu_2_1" \ |
---|
| 203 | "stop" "$dia_cluster_setup_menu_2_2" \ |
---|
| 204 | "restart" "$dia_cluster_setup_menu_2_3" \ |
---|
| 205 | "exit" "$dia_exit" 2>$clusterSetup |
---|
[162] | 206 | |
---|
| 207 | if [ "$(cat $clusterSetup)" == "start" ]; then |
---|
[186] | 208 | echo -e "\n$cluster_setup_echo_1" |
---|
| 209 | for node in $(cat $runNodes) |
---|
[162] | 210 | do |
---|
[176] | 211 | ssh -o StrictHostKeyChecking=no $node "$NutchEZ_Install_PATH/nutch/bin/hadoop-daemon.sh start datanode \ |
---|
[186] | 212 | ; $NutchEZ_Install_PATH/nutch/bin/hadoop-daemon.sh start tasktracker" 2>/dev/null |
---|
| 213 | [ $? == "0" ] || echo "$cluster_setup_echo_error $node !!!" |
---|
[162] | 214 | done |
---|
| 215 | elif [ "$(cat $clusterSetup)" == "stop" ]; then |
---|
[186] | 216 | echo -e "\n$cluster_setup_echo_3" |
---|
[172] | 217 | for node in $(cat $runNodes) |
---|
[162] | 218 | do |
---|
[176] | 219 | ssh -o StrictHostKeyChecking=no $node "$NutchEZ_Install_PATH/nutch/bin/hadoop-daemon.sh stop datanode \ |
---|
[186] | 220 | ; $NutchEZ_Install_PATH/nutch/bin/hadoop-daemon.sh stop tasktracker" 2>/dev/null |
---|
| 221 | [ $? == "0" ] || echo "$cluster_setup_echo_error $node !!!" |
---|
[162] | 222 | done |
---|
[177] | 223 | elif [ "$(cat $clusterSetup)" == "restart" ]; then |
---|
[186] | 224 | echo -e "\n$cluster_setup_echo_5" |
---|
[172] | 225 | for node in $(cat $runNodes) |
---|
| 226 | do |
---|
[176] | 227 | ssh -o StrictHostKeyChecking=no $node "$NutchEZ_Install_PATH/nutch/bin/hadoop-daemon.sh stop datanode \ |
---|
[177] | 228 | ; $NutchEZ_Install_PATH/nutch/bin/hadoop-daemon.sh stop tasktracker \ |
---|
| 229 | ; $NutchEZ_Install_PATH/nutch/bin/hadoop-daemon.sh start datanode \ |
---|
[186] | 230 | ; $NutchEZ_Install_PATH/nutch/bin/hadoop-daemon.sh start tasktracker" 2>/dev/null |
---|
| 231 | [ $? == "0" ] || echo "$cluster_setup_echo_error $node !!!" |
---|
[172] | 232 | done |
---|
[177] | 233 | else |
---|
| 234 | exit |
---|
[162] | 235 | fi |
---|
| 236 | } |
---|
| 237 | |
---|
[172] | 238 | ## [Tomcat Severice start/stop/restart] ## |
---|
[162] | 239 | function tomcat_switch(){ |
---|
[186] | 240 | tom_pids=$(ps x | grep -v 'grep' | grep "tomcat" | awk '{print $1}') |
---|
| 241 | if [ -n "$tom_pids" ]; then |
---|
| 242 | $DIALOG --clear --backtitle "$dia_back" --title "$dia_tomcat_switch_title_1" \ |
---|
| 243 | --msgbox "$dia_tomcat_switch_msg_1" 7 50 |
---|
[162] | 244 | else |
---|
[186] | 245 | $DIALOG --clear --backtitle "$dia_back" --title "$dia_tomcat_switch_title_1" \ |
---|
| 246 | --msgbox "$dia_tomcat_switch_msg_2" 7 50 |
---|
[162] | 247 | fi |
---|
| 248 | tomcatSwitch="/tmp/tomcatSwitch" |
---|
[186] | 249 | $DIALOG --clear --backtitle "$dia_back" --title "$dia_tomcat_switch_title_2" \ |
---|
| 250 | --menu "$dia_choose" 15 55 4 \ |
---|
| 251 | "start" "$dia_tomcat_switch_menu_1_1" \ |
---|
| 252 | "stop" "$dia_tomcat_switch_menu_1_2" \ |
---|
| 253 | "restart" "$dia_tomcat_switch_menu_1_3" \ |
---|
| 254 | "exit" "$dia_exit" 2>$tomcatSwitch |
---|
[162] | 255 | |
---|
[177] | 256 | if [ "$(cat $tomcatSwitch)" == "exit" ]; then |
---|
| 257 | exit 0 |
---|
| 258 | fi |
---|
| 259 | |
---|
| 260 | # jude $Tomcat_HOME/bin/startup.sh |
---|
| 261 | if [ ! -e $Tomcat_HOME/bin/startup.sh ]; then |
---|
[186] | 262 | echo -e "\n$tomcat_switch_echo_1 $Tomcat_HOME/bin/startup.sh" |
---|
[177] | 263 | exit |
---|
| 264 | fi |
---|
| 265 | |
---|
[184] | 266 | if [ ! -e $Tomcat_HOME/bin/shutdown.sh ]; then |
---|
[186] | 267 | echo -e "\n$tomcat_switch_echo_1 $Tomcat_HOME/bin/shutdown.sh" |
---|
[177] | 268 | exit |
---|
| 269 | fi |
---|
| 270 | |
---|
[162] | 271 | if [ "$(cat $tomcatSwitch)" == "start" ]; then |
---|
[186] | 272 | echo "$tomcat_switch_echo_3" |
---|
[176] | 273 | $Tomcat_HOME/bin/startup.sh |
---|
[162] | 274 | elif [ "$(cat $tomcatSwitch)" == "stop" ]; then |
---|
[186] | 275 | echo "$tomcat_switch_echo_4" |
---|
[176] | 276 | $Tomcat_HOME/bin/shutdown.sh |
---|
[186] | 277 | for tom_pid in $tom_pids |
---|
| 278 | do |
---|
| 279 | kill -9 $tom_pid 2>/dev/null |
---|
| 280 | done |
---|
[162] | 281 | elif [ "$(cat $tomcatSwitch)" == "restart" ]; then |
---|
[186] | 282 | echo "$tomcat_switch_echo_5" |
---|
[176] | 283 | $Tomcat_HOME/bin/shutdown.sh |
---|
[186] | 284 | for tom_pid in $tom_pids |
---|
| 285 | do |
---|
| 286 | kill -9 $tom_pid 2>/dev/null |
---|
| 287 | done |
---|
[176] | 288 | $Tomcat_HOME/bin/startup.sh |
---|
[162] | 289 | else |
---|
| 290 | exit 0 |
---|
| 291 | fi |
---|
| 292 | } |
---|
| 293 | |
---|
[172] | 294 | ## [Tomcat Port Change] ## |
---|
[162] | 295 | function tomcat_port(){ |
---|
| 296 | |
---|
[176] | 297 | if [ ! -e $Tomcat_HOME/conf/server.xml ]; then |
---|
[186] | 298 | $DIALOG --clear --backtitle "$dia_back" --title "$dia_tomcat_port_title_1" \ |
---|
| 299 | --msgbox "$dia_tomcat_port_msg_1 $Tomcat_HOME/conf/server.xml !!!" 10 50 |
---|
[162] | 300 | exit |
---|
| 301 | fi |
---|
| 302 | tomcatPort="/tmp/tomcatPort" |
---|
[186] | 303 | $DIALOG --clear --backtitle "$dia_back" --title "$dia_tomcat_port_title_2" \ |
---|
| 304 | --inputbox "$dia_tomcat_port_input_1" 10 55 2>$tomcatPort |
---|
[162] | 305 | |
---|
[177] | 306 | if [ -z "$(cat $tomcatPort)" ]; then |
---|
[162] | 307 | exit |
---|
| 308 | else |
---|
[176] | 309 | modify_line_nu=$(cat -n $Tomcat_HOME/conf/server.xml | grep -v SSL | grep 'HTTP/1.1' | grep '<Connector' | awk '{print $1}') |
---|
[182] | 310 | sed -i "${modify_line_nu}c <Connector port=\"$(cat $tomcatPort)\" protocol=\"HTTP/1.1\"" $Tomcat_HOME/conf/server.xml |
---|
[186] | 311 | |
---|
| 312 | tom_pids=$(ps x | grep -v 'grep' | grep "tomcat" | awk '{print $1}') |
---|
[176] | 313 | $Tomcat_HOME/bin/shutdown.sh |
---|
[186] | 314 | for tom_pid in $tom_pids |
---|
| 315 | do |
---|
| 316 | kill -9 $tom_pid 2>/dev/null |
---|
| 317 | done |
---|
[176] | 318 | $Tomcat_HOME/bin/startup.sh |
---|
[162] | 319 | fi |
---|
| 320 | } |
---|
| 321 | |
---|
| 322 | |
---|
[172] | 323 | ## [Language Change] ## |
---|
[162] | 324 | function lang_switch(){ |
---|
| 325 | langSwitch="/tmp/langSwitch" |
---|
[186] | 326 | $DIALOG --clear --backtitle "$dia_back" --title "$dia_lang_title_1" \ |
---|
| 327 | --menu "$dia_choose" 15 55 3 \ |
---|
| 328 | "en_US" "$dia_lang_menu_1_1" \ |
---|
| 329 | "zh_TW" "$dia_lang_menu_1_2" \ |
---|
| 330 | "Exit" "$dia_exit" 2>$langSwitch |
---|
[162] | 331 | # |
---|
[177] | 332 | if [ "$(cat $langSwitch)" == "Exit" ]; then |
---|
| 333 | exit |
---|
[186] | 334 | elif [ "$(cat $langSwitch)" == "en_US" ]; then |
---|
[194] | 335 | source $Work_Path/lang_en_US_nutchez |
---|
[186] | 336 | main_menu |
---|
| 337 | menu_choose |
---|
| 338 | elif [ "$(cat $langSwitch)" == "zh_TW" ]; then |
---|
[194] | 339 | source $Work_Path/lang_zh_TW_nutchez |
---|
[186] | 340 | main_menu |
---|
| 341 | menu_choose |
---|
[177] | 342 | fi |
---|
[162] | 343 | } |
---|
| 344 | |
---|
[186] | 345 | ## [Menu_choose] ## |
---|
| 346 | function menu_choose(){ |
---|
[162] | 347 | case $(cat $main_choice) in |
---|
[174] | 348 | "cluster_status") |
---|
| 349 | cluster_status;; |
---|
[186] | 350 | "cluster_setup") |
---|
| 351 | cluster_setup;; |
---|
[183] | 352 | "server_setup") |
---|
| 353 | server_setup;; |
---|
[162] | 354 | "tomcat_switch") |
---|
| 355 | tomcat_switch;; |
---|
| 356 | "tomcat_port") |
---|
| 357 | tomcat_port;; |
---|
| 358 | "lang_switch") |
---|
| 359 | lang_switch;; |
---|
| 360 | esac |
---|
[186] | 361 | } |
---|
| 362 | |
---|
| 363 | # [Main Code] # |
---|
| 364 | if [ $USER != "nutchuser" ]; then |
---|
| 365 | echo -e "\n$user_error" |
---|
| 366 | exit |
---|
| 367 | fi |
---|
| 368 | |
---|
| 369 | prepare_lang |
---|
| 370 | prepare_check |
---|
| 371 | main_menu |
---|
| 372 | menu_choose |
---|