当前位置:网站首页>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
边栏推荐
- 微信小程序转支付宝小程序注意事项
- 【场景化解决方案】钉钉财务审批同步金蝶云星空
- [V&N2020 Open] Memory Forensics
- 数据库期末复习这一篇就够了(期末预习大概也行)
- 【场景化解决方案】构建医疗通讯录,“慧医钉”助力医院实现数字化管理
- 【CNN】2022 ECCV Oral 自反馈学习的mixup训练框架AutoMix
- 探索APP性能优化之稳定性优化(解决方案)
- bs4的使用基础学习
- uniapp编译到小程序后丢失static文件夹问题
- parse <compoN> error: Custom Component‘name should be form of my-component, not myComponent or MyCom
猜你喜欢

Regular Expressions for Shell Programming

UE4 RTS frame selection function implementation

Venture DAO 行业研报:宏观和经典案例分析、模式总结、未来建议

【场景化解决方案】构建门店通讯录,“门店通”实现零售门店标准化运营

XCTF高校战“疫”网络安全分享赛Misc wp

【场景化解决方案】构建设备通讯录,制造业设备上钉实现设备高效管理

JVM进程诊断利器——Arthas

leetcode 36. 有效的数独(模拟题)

Failed to mount component: template or render function not defined.

算术表达式求值演示
随机推荐
BUUCTF MISC brush notes (2)
leetcode 37. 解数独 (困难)
ctf misc 图片题知识点
零搜索量的关键词,你需要布局吗?
uva11624 Fire! (双bfs)
[漏洞复现]CVE-2018-12613(远程文件包含)
The difference between big-endian and little-endian storage is easy to understand at a glance
【场景化解决方案】OA审批与金智CRM数据同步
leetcode 32. 最长有效括号 (困难)
requests之防盗链学习
PID控制电机输出作为电机PWM占空比输入的理解
【场景化解决方案】构建设备通讯录,制造业设备上钉实现设备高效管理
The 5th Blue Cap Cup preliminary misc reappears after the game
大端小端存储区别一看即懂
法院3D导航系统-轻松实现室内实时定位导航
XCTF高校战“疫”网络安全分享赛Misc wp
【LeetCode每日一题】——225.用队列实现栈
XCTF College War "Epidemic" Network Security Sharing Competition Misc wp
QT设置exe可执行文件的图标
【CNN】2022 ECCV 对比视觉Transformer的在线持续学习