nmon是監控服務器的一個工具,能夠自動生成快照,每次執行命令就能夠了shell
這裏寫了一個小的shell腳本,練習一下服務器
#!/bin/sh OSType=`uname` #判斷系統類型,選擇不一樣命令 if [ $OSType = "Linux" ];then if [ -x "nmon" ];then ./nmon -s ${1} -c ${2} -t -F ${3}_${4}_$(date +%y%m%d%H%M%S).nmon echo "${1}" echo "${2}" echo "${3}" echo "${4}" else echo "you need to put the file of nmon to this path,or chmod +x nmon" fi elif [ $OSType != "Linux" ];then nmon -s ${1} -c ${2} -t -F ${3}_${4}_$(date +%y%m%d%H%M%S).nmon fi