当前位置:网站首页>shell 定时监控并处理脚本
shell 定时监控并处理脚本
2022-08-09 08:58:00 【寻找手艺人】
1. 问题描述
yarn 中mapreduce任务一直在NEW_SAVING状态hold不动,导致后续任务不能正常秩序。
2.脚本内容
现写如下脚本,达到定时监控并处理
oo.sh
#!/bin/bash
if [[ ! -s /usr/local/job_env/shell/NEW_SAVING.txt ]]; then
echo -e `yarn application -list -appStates NEW_SAVING |grep application_ |grep -v yarn-ats |awk '{print $1}' >/usr/local/job_env/shell/NEW_SAVING.txt`
else
appids=$(cat /usr/local/job_env/shell/NEW_SAVING.txt)
current_appids=`yarn application -list -appStates NEW_SAVING |grep application_ |grep -v yarn-ats |awk '{print $1}'`
#echo "---------------------定义空数组------------------------------"
declare -a curr_arr
curr_arr=()
index=0
#echo "---------------------遍历当前appids--------------------------"
for item in $current_appids
do
# echo "###"$item
if [[ "${appids[@]}" =~ "${item}" ]]; then
#echo "$item exists"
echo `yarn app -kill ${
item}`
else
#echo "$item not exists"
curr_arr[$index]=$item
let index+=1
fi
done
index=0
#echo "---------------------校验------------------------------------"
if [[ ${#curr_arr[@]} -eq 0 ]];then
echo `cat /dev/null>/usr/local/job_env/shell/NEW_SAVING.txt`
else
echo ${curr_arr[@]}>/usr/local/job_env/shell/NEW_SAVING.txt
fi
fi
3.定时任务
crontab表达式,每日00点到10点之间,每半小时执行一次
*/30 00-10 * * * /usr/local/oo.sh>>/usr/local/log/cron_oo.log
边栏推荐
猜你喜欢
![[MySQL]mysql: Solve the problem of [Err] 1093 - You can't specify target table 'table name' for update in FROM clause](/img/76/8e6a3a1c5fdc9bffc0c7c9187a027c.png)
[MySQL]mysql: Solve the problem of [Err] 1093 - You can't specify target table 'table name' for update in FROM clause

Three handshakes, four waves

The principle and configuration of VLAN

requests之防盗链学习

Redis redis 】 【 the expiration of listening

微信小程序获取用户收货地址列表wx.chooseAddress

bs4之爬取诗词学习

parse <compoN> error: Custom Component‘name should be form of my-component, not myComponent or MyCom

The 5th Blue Cap Cup preliminary misc reappears after the game

PoPW token distribution mechanism may ignite the next bull market
随机推荐
大学四年不努力,出社会后浑浑噩噩深感无力,辞去工作,从头开始
基于蓝牙定位功能开发的医院智能导航系统
leetcode 32. 最长有效括号 (困难)
Redis缓存设计
uniapp编译到小程序后丢失static文件夹问题
内存监控以及优化
【KD】2022 KDD Compressing Deep Graph Neural Networks via Adversarial Knowledge Distillation
UE4 RTS 框选功能实现
小程序调用百度api实现图像识别
The difference between big-endian and little-endian storage is easy to understand at a glance
一篇文章带你熟悉 TCP/IP 协议(网络协议篇二)
[V&N2020 Open] Memory Forensics
内存中的swap机制
VNCTF2021 部分题目复现
QT设置exe可执行文件的图标
[Vulnerability reproduction] CVE-2018-7490 (path traversal)
法院3D导航系统-轻松实现室内实时定位导航
Regular Expressions for Shell Programming
LAN技术-6MSTP
Max Flow P