If I get the time I will come back & explain what the script does. Actually maybe not the code is commented.
Here we go the script:
- Code: Select all
#!/bin/bash
#written via TheeMahn
#Get CPU model
PROC=`cat /proc/cpuinfo | grep 'model name' | sed -e 's/.*: //' | uniq`
echo $PROC
#Create conky skelaton
echo 'background yes
font Vibrocentric:size=10
xftfont Vibrocentric:size=10
use_xft yes
xftalpha 0.1
update_interval 1.0
total_run_times 0
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
draw_shades yes
draw_outline no
draw_borders no
draw_graph_borders no
minimum_size 206 5
maximum_width 206
default_color e6df7e
default_shade_color 000000
default_outline_color 000000
alignment top_right
gap_x 6
gap_y 22
no_buffers yes
cpu_avg_samples 2
override_utf8_locale no
uppercase no # set to yes if you want all text to be in uppercase
use_spacer no
' > ~/.conkyrc
#Count number of processor cores
CORES=1
CORES=`cat /proc/cpuinfo | grep "processor" | wc -l`
echo $CORES "Cpu core(s) Detected."
echo 'TEXT
${font Aerial:style=Bold:pixelsize=12}SYSTEM${font Vibrocentric:size=10} ${hr 1 }
Hostname: $alignr$nodename
Kernel: $alignr$kernel
Uptime: $alignr$uptime
Processes: ${alignr}$processes ($running_processes running)
Load: ${alignr}$loadavg
'$PROC'
CPU Usage: ${alignc} ${freq}MHz X '$CORES '
${cpu cpu0}% ${alignr}${cpubar cpu0 5,170}
${hr 1}
Cores:' >> ~/.conkyrc
#Create a cpubar for each core
COUNTER=0
while [ $COUNTER != $CORES ]; do
let COUNTER=COUNTER+1
echo '${cpu cpu'$COUNTER'}% ${alignr}${cpubar cpu'$COUNTER' 5,170}' >> ~/.conkyrc
done
#Output disk I/O bar top processes memory useage etc.
echo '${hr 1}
Disk I/O: ${diskio} ${alignr}
${diskiograph /dev/sda 25,200}
${hr 1}
RAM ${alignr}$mem / $memmax ($memperc%)
${membar 4}
${font Vibrocentric:pixelsize=49}${alignc}${time %H:%M}${font Vibrocentric:size=10}
Highest CPU $alignr CPU% MEM%
${hr 1}
${top name 1}$alignr${top cpu 1}${top mem 1}
${top name 2}$alignr${top cpu 2}${top mem 2}
${hr 1}
Highest MEM $alignr CPU% MEM%
${hr 1}
${top_mem name 1}$alignr${top_mem cpu 1}${top_mem mem 1}
${top_mem name 2}$alignr${top_mem cpu 2}${top_mem mem 2}
${hr 1}
${font Aerial:style=Bold:pixelsize=12}FILESYSTEM ${font Vibrocentric:size=10}${hr 1}
Root: ${alignr}${fs_free /} / ${fs_size /}
${fs_bar 4 /}' >> ~/.conkyrc
#Detect hard disks & create a bar for each mount point
echo "Internal / External storage detected:"
echo "/ - Root"
for i in $( ls /media/ );
do
echo $i
echo $i': ${alignr}${fs_free /media/'$i'} / ${fs_size /media/'$i'}
${fs_bar 4 /media/'$i'}' >> ~/.conkyrc
done
echo '${hr 1}
${font Aerial:style=Bold:pixelsize=12}NETWORK ${font Vibrocentric:size=10}${hr 1}' >> ~/.conkyrc
#Detect "Active" network and propigate Network Xfer bar
ACTIVE=`ifconfig | grep -B 1 inet | head -1 | awk '{print $1}'`
echo "Active network adapter: "$ACTIVE
echo 'Down ${downspeed '$ACTIVE'} k/s ${alignr}Up ${upspeed '$ACTIVE'} k/s
${downspeedgraph '$ACTIVE' 25,107 cccccc e6df7e} ${alignr}${upspeedgraph '$ACTIVE' 25,107 cccccc e6df7e}
Total ${totaldown '$ACTIVE'} ${alignr}Total ${totalup '$ACTIVE'}' >> ~/.conkyrc
If you are running Ultimate Edition 2.6 conky is pre-installed for you. Ultimate Edition 2.5 or less in a terminal:
- Code: Select all
sudo apt-get install conky-all
To start it after the script is executed in a terminal:
- Code: Select all
conky
Any feedback is appreciated.
Enjoy,
TheeMahn