linux中的monitor-cpu脚本

时间:2016-02-02 12:43:36

标签: linux bash shell unix

 1  # this script checks average cpu load for last 5 minutes
 2  # since this server has only one core the system will be fully #utilized when average cpu load values reach 1.00.
 3  # This script will send warning alert if value exceedes 0.80 so that action can be taken promptly.
 4  # finally it will display the top 10 users and their processes #with highest cpu utilization.
 5  #!/bin/bash
 6  up=$(uptime | awk '{ print$10 }'| sed 's/,$//')
 7  if($up -gt 0.80];
 8  echo "============================================" >> /tmp/load
 9  ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10 >> /tmp/load
10  mail -s "warning alert on QA server , CPU load exceedes the warning threshold" priyank.dewli@qpay.com.qa issuing-alerts@nexxuspg.com < /tmp/load
11  exit

=======================
 error after executing the script
line 12: syntax error: unexpected end of file

1 个答案:

答案 0 :(得分:0)

检查此行:

private JMenuItem newItem(){
    JMenuItem item=new JMenuItem();
    item.setText("One");
    item.setToolTipText("One");
    ActionListener mylistener = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            MyPopupMenu.this.setVisible(false);
            Class1 class1=new Class1(file);
            try {
                class1.start();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    };
    item.addActionListener(mylistener);
    return item;
}

我想你想要

if($up -gt 0.80];