提交各组件部署Ansible剧本初版
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# netconsole This loads the netconsole module with the configured parameters.
|
||||
#
|
||||
# chkconfig:123456 40 60
|
||||
# description: keepyarnworker
|
||||
source /etc/profile
|
||||
PRO_NAME=keepyarnworker
|
||||
|
||||
INS_DIR={{ deploy_dir }}
|
||||
#版本
|
||||
VERSION={{ hadoop_version }}
|
||||
|
||||
case $1 in
|
||||
start)
|
||||
master=`ps -ef | grep "dae-yarnworker.sh" | grep -v grep | wc -l`
|
||||
if [ $master -lt 1 ];then
|
||||
nohup $INS_DIR/$VERSION/sbin/dae-yarnworker.sh > /dev/null 2>&1 &
|
||||
fi
|
||||
;;
|
||||
|
||||
stop)
|
||||
HAS_KEEP_SHELL=`ps -ef | grep "dae-yarnworker.sh" | grep -v grep | awk '{print $2}'`
|
||||
if [ $HAS_KEEP_SHELL ];then
|
||||
echo "守护进程PID:$HAS_KEEP_SHELL"
|
||||
kill -9 $HAS_KEEP_SHELL
|
||||
fi
|
||||
|
||||
sh $INS_DIR/$VERSION/sbin/yarn-daemon.sh stop nodemanager > /dev/null
|
||||
;;
|
||||
|
||||
status)
|
||||
HAS_NM=`ps -ef | grep "org.apache.hadoop.yarn.server.nodemanager.NodeManager" | grep -v grep | wc -l`
|
||||
|
||||
if [ $HAS_NM -eq "0" ];then
|
||||
echo "NodeManager not running!"
|
||||
else
|
||||
echo "NodeManager is running!"
|
||||
fi
|
||||
;;
|
||||
|
||||
* )
|
||||
echo "use keepyarnworker [start|stop|status]"
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user