Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. #
  2. # ~/.bash_profile
  3. #
  4. # Collect useful information about your system
  5. # $USER is automatically defined
  6.  
  7. RB="\e[01;91m"
  8. GB="\e[01;92m"
  9. D="\e[49m"
  10. UT=`cat /proc/uptime | cut -d ' ' -f 1 | cut -d . -f 1`
  11. PRETTY=`uptime -p`
  12.  
  13. if [ "$UT" -ge "43200" ]
  14.  
  15. then
  16. UPTIME="$GB$PRETTY$D"
  17. else
  18. UPTIME="$RB$PRETTY$D"
  19. fi
  20.  
  21. cpu=`cat /sys/class/thermal/thermal_zone0/temp`
  22.  
  23. if [ "$((cpu/1000))" -gt "0" ] || [ "$((cpu/1000))" -lt "50" ]
  24.  
  25. then
  26. TEMP="\e[92m$((cpu/1000))°C"
  27.  
  28. elif [ "$((cpu/1000))" -ge "50" ] || [ "$((cpu/1000))" -lt "60" ]
  29.  
  30. then
  31. TEMP="\e[93m$((cpu/1000))°C"
  32.  
  33. elif [ "$((cpu/1000))" -ge "60" ]
  34.  
  35. then
  36. TEMP="\e[91m$((cpu/1000))°C"
  37.  
  38. else
  39. TEMP="Not Available"
  40.  
  41. fi
  42.  
  43. HOSTNAME=`hostname -a`
  44. KERNEL=`uname -r`
  45. CPU=`uname -p`
  46. ARCH=`uname -m`
  47. DU=`df --output=pcent / | sed 1d | cut -d '%' -f 1`
  48.  
  49.  
  50. if [ "$DU" -gt "0" ] || [ "$DU" -lt "70" ]
  51.  
  52. then
  53. DISK="\e[92m$DU%"
  54.  
  55. elif [ "$DU" -ge "70" ] || [ "$DU" -lt "90" ]
  56.  
  57. then
  58. DISK="\e[93m$DU%"
  59.  
  60. elif [ "$DU" -ge "90" ]
  61.  
  62. then
  63. DISK="\e[91m$DU%"
  64.  
  65. else
  66. DISK="Not Available"
  67.  
  68. fi
  69.  
  70. # The different colours as variables
  71. W="\033[01;37m"
  72. B="\033[01;34m"
  73. R="\033[01;36m"
  74. G="\033[01;92m"
  75. X="\033[00;37m"
  76. echo -e "$B#===============================================================================#"
  77. echo -e " $W Welcome $G $USER $W to $G $HOSTNAME "
  78. echo -e " $R ARCH $W= $ARCH "
  79. echo -e " $R KERNEL $W= $KERNEL "
  80. echo -e " $R UPTIME $W= $UPTIME "
  81. echo -e " $R CPU TEMP $W= $TEMP "
  82. echo -e " $R DISK USAGE $W=$DISK "
  83. echo -e "$B#===============================================================================#"
  84. echo -e "$X"
  85.  
  86. [[ -f ~/.bashrc ]] && . ~/.bashrc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement