zoukankan      html  css  js  c++  java
  • 用户登陆显示cpu、负载、内存信息

    #用户登陆显示cpu、负载、内存信息
    #!/bin/bash
    #
    hostip=`ifconfig eth0 |awk -F" +|:" '/Bcast/{print $4}'`
    date=`date "+%F %T %A"`
    load=`uptime |awk -F: '{print $NF}'`
    usage=`df -h / | awk 'NR==2{print $(NF-1)}'`
    fssize=`df -h / |awk 'NR==2{print $2}'`
    usernum=`uptime |awk '{print $4}'`
    memused=`free -k |awk '/Mem/ {print $3/$2*100}'`%
    echo -e '33[32;1m################ Welcome to Server #############################33[0m'
    cat <<EOF
      System information as of $date
      System load:  $load               
      Usage of /:   $usage of $fssize
      Users logged in:  $usernum users
      Memory usage: $memused
      IP address for eth0: $hostip
    EOF
    echo -e '33[32;1m#################################################################33[0m'
    
    
    把上面的文本cp到 /etc/profile.d/1.sh
    然后chmod +x /etc/profile.d/1.sh
  • 相关阅读:
    mysql 版本查看
    js 中文乱码
    浏览器内核
    Squid 代理服务器
    minicygwin
    firefox 插件开发
    ocx c++
    NetBeans
    android 虚拟机
    ExpandableListView
  • 原文地址:https://www.cnblogs.com/icemonkey/p/10447569.html
Copyright © 2011-2022 走看看