zoukankan      html  css  js  c++  java
  • shell学习

    监控内存脚本

    #!/bin/sh
    echo -n "manager_mem:";
    ps ux | grep manager.jar | grep -v grep | awk 'BEGIN{s=0}{s=s+$6}END{print s}';
    echo -n "user_process:";
    ps -U map H | wc -l;

    ct执行重启脚本

    #!/bin/bash
    cd /home/map/manager;
    #u=`ps ux | grep manager.jar | grep -v grep | awk 'BEGIN{s=0}{s=s+$6}END{printf s}'`
    u=`ps uxH | grep manager.jar  | wc -l`
    echo $u
    #if [ $u -gt 6069392 ];then
    if [ $u -gt 1500 ];then
    #echo "memory bigger then 8069392, restart the program";
    echo "thread bigger then 1500, restart the program";
    ps aux|grep "manager.jar"|grep -v "grep" |awk '{print $2}'|xargs kill -9
    sleep 1
    nohup sh ./bin/start.sh </dev/null >/dev/null 2>&1 &
    fi;

    shell中 

    > /dev/null < /dev/null 2>&1

    分别什么意思

    > /dev/null 输出重定向

    2>&1 错误页重定向到标准输出

    < /dev/null 把标准输入重定向,/dev/null这个文件作为读的时候有个特点,就是一读,马上就返回0,意味着文件结束了。这样在中控机执行的时候就可以马上推迟

    shell 13问

    http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=218853&page=7#pid1636825

  • 相关阅读:
    函数
    vue中v-for循环如何将变量带入class的属性名中
    代码规范 前端导航
    2019.8.5 mysql 删除 更新
    2019.8.1
    2019.7.31 Xshell简单学习
    日常使用知识点
    FormData实现文件多次添加累加上传和选择删除
    上传图片
    验证码
  • 原文地址:https://www.cnblogs.com/zlingh/p/4491287.html
Copyright © 2011-2022 走看看