터미널 접속 스크린
# vi /etc/motd.sh
~~~스크린내용 입력~~~
- 실행권한 부여
# chmod +x /etc/motd.sh
- profile 쉘 추가
# echo "/etc/motd.sh" >> /etc/profile
- 스크린 확인
# source /etc/profile
- CPU모델확인
# cat /proc/cpuinfo | head -20 | grep "model name" | awk '{print $4, $5, $6, $7, $8, $10}'
# Intel(R) Xeon(R) CPU E5-1620 0 3.60GHz
하드디스크 온도 확인
- 설치
# yum install hddtemp
- 하드디스크 온도 확인
# hddtemp /dev/sda
# /dev/sdb: WDC WD20EZAZ-00GGJB0: 29°C
- 하드디스크 온도(숫자) 만 가져오기
4번째 string 온도를 가지고 와서 숫자로 변환, 반올림으로 정수 구함
# hddtemp /dev/sdb | awk '{print $4}' | awk '{printf("%d\n",$1 - 0.5);}'
# 29
CPU 온도 확인
-설치
# yum install lm_sensors
-센서 목록 갱신(하드웨어 스캔, 처음 설치후 한번 실행)
# sensors-detect
-옵션
"-u" : Row output (라인출력)
--------------------------------------------
# sensors -u
coretemp-isa-0000
Adapter: ISA adapter
Package id 0:
temp1_input: 36.000
temp1_max: 79.000
temp1_crit: 97.000
temp1_crit_alarm: 0.000
Core 0:
temp2_input: 35.000
temp2_max: 79.000
temp2_crit: 97.000
temp2_crit_alarm: 0.000
Core 1:
temp3_input: 32.000
temp3_max: 79.000
temp3_crit: 97.000
temp3_crit_alarm: 0.000
Core 2:
temp4_input: 36.000
temp4_max: 79.000
temp4_crit: 97.000
temp4_crit_alarm: 0.000
Core 3:
temp5_input: 34.000
temp5_max: 79.000
temp5_crit: 97.000
temp5_crit_alarm: 0.000
--------------------------------------------
- 온도 확인
# sensors
- CPU 온도(숫자) 가져오기 (head 몇번째까지 출력)
# sensors -u | head -11 |grep "temp2_input"| awk '{print $2 }' |awk '{printf("%d\n",$1 + 0.5);}'
# sensors -u | head -20 |grep "temp3_input"| awk '{print $2 }' |awk '{printf("%d\n",$1 + 0.5);}'
# sensors -u | head -30 |grep "temp4_input"| awk '{print $2 }' |awk '{printf("%d\n",$1 + 0.5);}'
# sensors -u | head -40 |grep "temp5_input"| awk '{print $2 }' |awk '{printf("%d\n",$1 + 0.5);}'
- CPU 온도(숫자) 가져오기 (sed 특정라인 출력)
# sensors -u | sed -n 18p |grep "temp2_input"| awk '{print $2 }' |awk '{printf("%d\n",$1 + 0.5);}'
# sensors -u | sed -n 23p |grep "temp3_input"| awk '{print $2 }' |awk '{printf("%d\n",$1 + 0.5);}'
# sensors -u | sed -n 28p |grep "temp4_input"| awk '{print $2 }' |awk '{printf("%d\n",$1 + 0.5);}'
# sensors -u | sed -n 33p |grep "temp5_input"| awk '{print $2 }' |awk '{printf("%d\n",$1 + 0.5);}'
vi /etc/motd.sh
chmod +x /etc/motd.sh
echo '/etc/motd.sh' >> /etc/profile
/etc/motd.sh
#!/bin/sh
# https://gist.github.com/cha55son/6042560
# http://patorjk.com/software/taag/
clear
#글자색깔 설정
#printf "\e[1;31m Hello World\e[0m"
printf "\n██████████████████████████████████████████████████████████████████████████\n\n"
printf "\e[1;31m"
printf "\t██ ██ ██████ ███████ ██████ ██████ ██████ \n"
printf "\t██ ██ ██ ██ ███ ██ ██ ██ ████ \n"
printf "\t███████ ██████ ███ ███████ █████ ██ ██ ██ \n"
printf "\t██ ██ ██ ███ ██ ██ ██ ████ ██ \n"
printf "\t██ ██ ██ ███████ ██████ ███████ ██████ \n\n"
printf "\e[0m"
printf "██████████████████████████████████████████████████████████████████████████\n"
HOSTNAME=`uname -n`
CPUINFO=`cat /proc/cpuinfo | head -20 | grep "model name" | awk '{print $4, $5, $6, $7, $8, $10}'`
# CPU온도 확인
# yum install lm_sensors
CPUCORE1=`sensors -u | head -11 |grep "temp2_input"| awk '{print $2 }' |awk '{printf("%d\n",$1 + 0.5);}'`
CPUCORE2=`sensors -u | head -20 |grep "temp3_input"| awk '{print $2 }' |awk '{printf("%d\n",$1 + 0.5);}'`
CPUCORE3=`sensors -u | head -30 |grep "temp4_input"| awk '{print $2 }' |awk '{printf("%d\n",$1 + 0.5);}'`
CPUCORE4=`sensors -u | head -40 |grep "temp5_input"| awk '{print $2 }' |awk '{printf("%d\n",$1 + 0.5);}'`
# CPU 로드(1분, 5분, 15분 로드)
LOAD1=`cat /proc/loadavg | awk {'print $1'}`
LOAD5=`cat /proc/loadavg | awk {'print $2'}`
LOAD15=`cat /proc/loadavg | awk {'print $3'}`
# HDD온도 확인
# yum install hddtemp
sda=`hddtemp /dev/sda | awk '{print $4}' | awk '{printf("%d\n",$1 - 0.5);}'`
sdb=`hddtemp /dev/sdb | awk '{print $4}' | awk '{printf("%d\n",$1 - 0.5);}'`
sdc=`hddtemp /dev/sdc | awk '{print $4}' | awk '{printf("%d\n",$1 - 0.5);}'`
# 메모리 사용량
MEMORY1=`free -t -m | grep "Mem" | awk '{print $3" MB";}'`
MEMORY2=`free -t -m | grep "Mem" | awk '{print $2" MB";}'`
# 시스템 업타임
uptime=`cat /proc/uptime | cut -f1 -d.`
upDays=$((uptime/60/60/24))
upHours=$((uptime/60/60%24))
upMins=$((uptime/60%60))
upSecs=$((uptime%60))
# 디스크 사용량
root=`df -Ph | grep root | awk '{print $3 " / " $2 " (" $5 ")"}'`
raid=`df -Ph | grep raid | awk '{print $3 " / " $2 " (" $5 ")"}'`
echo "
- CPU Model........... : $CPUINFO
- CPU usage........... : $LOAD1, $LOAD5, $LOAD15 (1분, 5분, 15분)
- CPU Temperature..... : $CPUCORE1°C, $CPUCORE2°C, $CPUCORE3°C, $CPUCORE4°C
- Memory used......... : $MEMORY1 / $MEMORY2
- Swap Memory used.... : `free -m | tail -n 1 | awk '{print $3}'` MB
- Disk Temperature..... : sda $sda°C, sdb $sdb°C, sdc $sdc°C
- Disk used root...... : $root
- DIsk used raid...... : $raid
- HostName............ : $HOSTNAME
- Release............. : `cat /etc/redhat-release`
- Kernel.............. : `uname -r`
- Users............... : Currently `users | wc -w` user(s) logged on
- System uptime....... : $upDays days $upHours hours $upMins minutes $upSecs seconds
██████████████████████████████████████████████████████████████████████████
"
https://gist.github.com/cha55son/6042560
'Linux > 설치 및 셋팅' 카테고리의 다른 글
Windows 10 Pro(EFI) + Ubuntu 20.04.4 desktop(EFI) 멀티부팅 및 우분투 복제(dd) (1) | 2022.09.16 |
---|---|
Ubuntu 22.04 Server 초기설정 (작업중) (0) | 2022.06.02 |
네트워크 대역폭 속도 저하 해결방안 (10Mbps, 100Mbps, 1000Mbps) (0) | 2021.06.06 |
리눅스 네트워크 대역폭 모니터링 (nload, iptop) (0) | 2021.06.06 |
CentOS 7.5 NIC Link is Down, NIC Link is 100 Mbps Full Deplex (0) | 2020.10.19 |