方式一
#!/bin/bash
case $1 in
"start")for host in hadoop102 hadoop103 hadoop104doecho "======start $host azkaban-exec-server======"ssh $host "cd /opt/module/azkaban/azkaban-exec-server/;bin/start-exec.sh"sleep 5sssh $host "cd /opt/module/azkaban/azkaban-exec-server/;curl -G \"$host:\$(<./executor.port)/executor?action=activate\" && echo"donessh hadoop102 "cd /opt/module/azkaban/azkaban-web-server/;bin/start-web.sh"
;;
"stop")ssh hadoop102 "cd /opt/module/azkaban/azkaban-web-server/;bin/shutdown-web.sh"for host in hadoop102 hadoop103 hadoop104doecho "======stop $host azkaban-exec-server"ssh $host "cd /opt/module/azkaban/azkaban-exec-server/;bin/shutdown-exec.sh"done
;;
*)echo "参数输入错误"
esac
方式二
#!/bin/bashuser=`whoami`
hadoop='hadoop'case $1 in
"start")for((host=102; host<=104; host++))doecho "======start $user@$hadoop$host azkaban-exec-server======"ssh $user@$hadoop$host "cd /opt/module/azkaban/azkaban-exec-server/;bin/start-exec.sh"sleep 5sssh $user@$hadoop$host "cd /opt/module/azkaban/azkaban-exec-server/;curl -G \"$hadoop$host:\$(<./executor.port)/executor?action=activate\" && echo"donessh hadoop102 "cd /opt/module/azkaban/azkaban-web-server/;bin/start-web.sh"
;;
"stop")ssh hadoop102 "cd /opt/module/azkaban/azkaban-web-server/;bin/shutdown-web.sh"for((host=102; host<=104; host++))doecho "======stop $user@$hadoop$host azkaban-exec-server"ssh $user@$hadoop$host "cd /opt/module/azkaban/azkaban-exec-server/;bin/shutdown-exec.sh"done
;;
*)echo "参数输入错误"
esac