conky获取cpu,主板,硬盘温度及启动
sean 编辑于2024-10-20 19:44软件相关
两个文件一个启动脚本.conky_start.sh:
#sleep 10 killall conky conky -c /home/bogon/.conkyrc exit
别忘记增加执行权限
chmod 755 /home/bogon/.conky_start.sh
还一个是用于pc配置文件.conkyrc:
conky.config = { alignment = 'top_right', background = false, border_width = 1, cpu_avg_samples = 2, default_color = 'white', default_outline_color = 'white', default_shade_color = 'grey', draw_borders = false, draw_graph_borders = true, draw_outline = false, draw_shades = false, use_xft = true, font = 'Dejavu Sans Mono:size=12', gap_x = 0, gap_y = 0, minimum_height = 5, minimum_width = 5, net_avg_samples = 2, no_buffers = true, out_to_console = false, out_to_stderr = false, extra_newline = false, own_window = true, own_window_class = 'Conky', own_window_type = 'desktop', stippled_borders = 0, update_interval = 1.0, uppercase = false, use_spacer = 'none', show_graph_scale = false, show_graph_range = false, own_window_argb_visual = true, own_window_transparent = true } conky.text = [[ #${color grey}${time %Y-%m-%d %a %H:%M:%S} #$hr ${color grey}Uptime:$color $uptime ${color grey}loading:$color $loadavg ${color green}CPU Usage: ${color yellow}${cpu cpu0}% ${color green}$hr ${color grey}CORE 1:$color ${freq_g 1}G ${cpu cpu1}% ${color green}${cpugraph cpu1 14,100} ${color grey}CORE 2:$color ${freq_g 2}G ${cpu cpu2}% ${color green}${cpugraph cpu2 14,100} #${color grey}CORE 3:$color ${freq_g 3}G ${cpu cpu3}% ${color green}${cpugraph cpu3 14,100} #${color grey}CORE 4:$color ${freq_g 4}G ${cpu cpu4}% ${color green}${cpugraph cpu4 14,100} ${color green}RAM: ${color yellow}$memperc% ($mem/$memmax) ${color green}$hr ${membar 6,180} ${color green}temperature $hr ${color grey}CPU: ${color yellow}${exec sensors | grep 'Package id 0' | cut -c17-18}°C #${color grey}CORE1: ${color yellow}${exec sensors | grep 'Core 0' | cut -c17-18}°C #${color grey}CORE2: ${color yellow}${exec sensors | grep 'Core 1' | cut -c17-18}°C ${color grey}Mainboard: ${color yellow}${acpitemp}°C #${color grey}HDD: ${color yellow}${exec hddtemp /dev/sda | cut -c35-36}°C ${color grey}HDD: ${color yellow}${exec hddtemp /dev/sda | cut -c24-28} ${color green}Disk: read/write $hr ${color grey}read:$color${diskio_read /dev/sda} ${color grey}write:$color${diskio_write /dev/sda} ${color green}${diskiograph_read /dev/sda 14,120} ${color red}${diskiograph_write /dev/sda 14,120} ${color green}File systems: $hr / $color${fs_used /}/${fs_size /} ${color yellow}${fs_bar 12,80 /} ${color green}Networking: $hr ${color grey}Down:$color ${downspeedf enp2s0}KiB ${color grey} Up:$color${upspeedf enp2s0}KiB ${color green}${downspeedgraph enp2s0 14,120} ${color red}${upspeedgraph enp2s0 14,120} ${color grey}Total:$color${totaldown enp2s0} ${color grey}Total:$color${totalup enp2s0} ${color green}NAME: PID CPU% MEM% ${color green}$hr ${color lightgrey}${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1} ${color lightgrey}${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2} ${color lightgrey}${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3} ${color lightgrey}${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4} ${color lightgrey}${top name 5} ${top pid 5} ${top cpu 5} ${top mem 5} ${color lightgrey}${top name 6} ${top pid 6} ${top cpu 6} ${top mem 6} #${color lightgrey}${top name 7} ${top pid 7} ${top cpu 7} ${top mem 7} #${color lightgrey}${top name 8} ${top pid 8} ${top cpu 8} ${top mem 8} #${color lightgrey}${top name 9} ${top pid 9} ${top cpu 9} ${top mem 9} #${color lightgrey}${top name 10} ${top pid 10} ${top cpu 10} ${top mem 10} ${color grey}Processes:${color yellow} $processes ${color grey}Running:${color yellow} $running_processes ]]
这个是用于笔记本(屏幕略小,字体略小)的配置文件:
conky.config = {
alignment = 'top_right',
background = false,
border_width = 1,
cpu_avg_samples = 2,
default_color = 'white',
default_outline_color = 'white',
default_shade_color = 'grey',
draw_borders = false,
draw_graph_borders = true,
draw_outline = false,
draw_shades = false,
use_xft = true,
font = 'Dejavu Sans Mono:size=10',
gap_x = 5,
gap_y = 10,
minimum_height = 3,
minimum_width = 5,
net_avg_samples = 2,
no_buffers = true,
out_to_console = false,
out_to_stderr = false,
extra_newline = false,
own_window = true,
own_window_class = 'Conky',
own_window_type = 'desktop',
stippled_borders = 0,
update_interval = 1.0,
uppercase = false,
use_spacer = 'none',
show_graph_scale = false,
show_graph_range = false,
own_window_argb_visual = true,
own_window_transparent = true
}
conky.text = [[
#${color grey}${time %Y-%m-%d %a %H:%M:%S}
#$hr
${color grey}Uptime:$color $uptime
${color grey}loading:$color $loadavg
${color green}CPU Usage: ${color yellow}${cpu cpu0}% ${color green}$hr
${color grey}CORE 1:$color ${freq_g 1}G ${cpu cpu1}% ${color green}${cpugraph cpu1 14,100}
${color grey}CORE 2:$color ${freq_g 2}G ${cpu cpu2}% ${color green}${cpugraph cpu2 14,100}
${color grey}CORE 3:$color ${freq_g 3}G ${cpu cpu3}% ${color green}${cpugraph cpu3 14,100}
${color grey}CORE 4:$color ${freq_g 4}G ${cpu cpu4}% ${color green}${cpugraph cpu4 14,100}
#${color grey}CORE 3:$color ${freq_g 3}G ${cpu cpu3}% ${color green}${cpugraph cpu3 14,100}
#${color grey}CORE 4:$color ${freq_g 4}G ${cpu cpu4}% ${color green}${cpugraph cpu4 14,100}
${color green}RAM: ${color yellow}$memperc% ($mem/$memmax) ${color green}$hr
${membar 6,180}
${color green}temperature $hr
${color grey}CPU: ${color yellow}${exec sensors | grep 'Package id 0' | cut -c17-18}°C
#${color grey}CORE1: ${color yellow}${exec sensors | grep 'Core 0' | cut -c17-18}°C
#${color grey}CORE2: ${color yellow}${exec sensors | grep 'Core 1' | cut -c17-18}°C
${color grey}Mainboard: ${color yellow}${acpitemp}°C
${color grey}Fan: ${color yellow}${exec sensors | grep 'fan1' | cut -c14-21}
#${color grey}HDD: ${color yellow}${exec hddtemp /dev/sda | cut -c33-34}°C
${color green}Disk: read/write $hr
${color grey}read:$color${diskio_read /dev/sda} ${color grey}write:$color${diskio_write /dev/sda}
${color green}${diskiograph_read /dev/sda 14,120} ${color red}${diskiograph_write /dev/sda 14,120}
${color green}File systems: $hr
/ $color${fs_used /}/${fs_size /} ${color yellow}${fs_bar 12,80 /}
${color green} /home $color${fs_used /home}/${fs_size /home} ${color yellow}${fs_bar 12,80 /home}
${color green} Wired: $hr
${color grey}Down:$color ${downspeedf enp0s25}KiB ${color grey} Up:$color${upspeedf enp0s25}KiB
${color green}${downspeedgraph enp0s25 14,120} ${color red}${upspeedgraph enp0s25 14,120}
${color grey}Total:$color${totaldown enp0s25} ${color grey}Total:$color${totalup enp0s25}
${color green} Wireless: $hr
${color grey}Down:$color ${downspeedf wlp3s0}KiB ${color grey} Up:$color${upspeedf wlp3s0}KiB
${color green}${downspeedgraph wlp3s0 14,120} ${color red}${upspeedgraph wlp3s0 14,120}
${color grey}Total:$color${totaldown wlp3s0} ${color grey}Total:$color${totalup wlp3s0}
${color green}NAME: PID CPU% MEM%
${color green}$hr
${color lightgrey}${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color lightgrey}${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgrey}${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color lightgrey}${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
${color lightgrey}${top name 5} ${top pid 5} ${top cpu 5} ${top mem 5}
${color lightgrey}${top name 6} ${top pid 6} ${top cpu 6} ${top mem 6}
${color lightgrey}${top name 7} ${top pid 7} ${top cpu 7} ${top mem 7}
${color lightgrey}${top name 8} ${top pid 8} ${top cpu 8} ${top mem 8}
${color lightgrey}${top name 9} ${top pid 9} ${top cpu 9} ${top mem 9}
${color lightgrey}${top name 10} ${top pid 10} ${top cpu 10} ${top mem 10}
${color grey}Processes:${color yellow} $processes ${color grey}Running:${color yellow} $running_processes
]]
hddtemp显示温度需要root权限所以要:
sudo chmod +s /usr/sbin/hddtemp
启动上有时候需要killall 之前的conky和sleep10防止启动失败
If you want to run conky automatically after each boot of your computer, you need to find out how to autostart a program. This depends on the Desktop Manager you are using. Putting one of the following commands into your autostart folder/file/script/command should work:
conky
sleep 20 && conky
conky -p 20
sh -c "sleep 20 && conky"
sleep 20
and -p 20
delay the start of conky by 20 seconds after your Desktop Environment has started. Adjust this value to your liking.
If you want to reload conky with the latest .conkyrc
file (e.g. because you changed a variable and want to see the consequences) use one of the following commands:
killall conky && conky
pkill conky && conky
目前的22寸的屏幕,h110配置文件~/.conkyrc
conky.config = {
alignment = 'top_right',
background = false,
border_width = 1,
cpu_avg_samples = 2,
default_color = 'white',
default_outline_color = 'white',
default_shade_color = 'grey',
draw_borders = false,
draw_graph_borders = true,
draw_outline = false,
draw_shades = false,
use_xft = true,
font = 'Dejavu Sans Mono:size=12',
gap_x = 0,
gap_y = 0,
minimum_height = 5,
minimum_width = 5,
net_avg_samples = 2,
no_buffers = true,
out_to_console = false,
out_to_stderr = false,
extra_newline = false,
own_window = true,
own_window_class = 'Conky',
own_window_type = 'desktop',
stippled_borders = 0,
update_interval = 5,
uppercase = false,
use_spacer = 'none',
show_graph_scale = false,
show_graph_range = false,
own_window_argb_visual = true,
own_window_transparent = true
}
conky.text = [[
#${color grey}${time %Y-%m-%d %a %H:%M:%S}
#$hr
${color grey}Uptime:$color $uptime
${color grey}loading:$color $loadavg
${color green}CPU Usage: ${color yellow}${cpu cpu0}% ${color green}$hr
${color grey}CORE 1:$color ${freq_g 1}G ${cpu cpu1}% ${color green}${cpugraph cpu1 14,100}
${color grey}CORE 2:$color ${freq_g 2}G ${cpu cpu2}% ${color green}${cpugraph cpu2 14,100}
#${color grey}CORE 3:$color ${freq_g 3}G ${cpu cpu3}% ${color green}${cpugraph cpu3 14,100}
#${color grey}CORE 4:$color ${freq_g 4}G ${cpu cpu4}% ${color green}${cpugraph cpu4 14,100}
${color green}RAM: ${color yellow}$memperc% ($mem/$memmax) ${color green}$hr
${membar 6,180}
${color green}temperature $hr
${color grey}CPU: ${color yellow}${exec sensors | grep 'Package id 0' | cut -c17-18}°C
${color grey}CORE1: ${color yellow}${exec sensors | grep 'Core 0' | cut -c17-18}°C
${color grey}CORE2: ${color yellow}${exec sensors | grep 'Core 1' | cut -c17-18}°C
#${color grey}CORE3: ${color yellow}${exec sensors | grep 'Core 2' | cut -c17-18}°C
#${color grey}CORE4: ${color yellow}${exec sensors | grep 'Core 3' | cut -c17-18}°C
${color grey}Mainboard: ${color yellow}${acpitemp}°C
${color grey}HDD: ${color yellow}${exec hddtemp /dev/sda | cut -c26-30}
${color green}Disk: read/write $hr
${color grey}read:$color${diskio_read /dev/sda} ${color grey}write:$color${diskio_write /dev/sda}
${color green}${diskiograph_read /dev/sda 14,120} ${color red}${diskiograph_write /dev/sda 14,120}
${color green}File systems: $hr
/ $color${fs_used /}/${fs_size /} ${color yellow}${fs_bar 12,80 /}
${color green}Networking: $hr
${color grey}Down:$color ${downspeedf enp0s31f6}KiB ${color grey} Up:$color${upspeedf enp0s31f6}KiB
${color green}${downspeedgraph enp0s31f6 14,120} ${color red}${upspeedgraph enp0s31f6 14,120}
${color grey}Total:$color${totaldown enp0s31f6} ${color grey}Total:$color${totalup enp0s31f6}
${color green}NAME: PID CPU% MEM%
${color green}$hr
${color lightgrey}${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color lightgrey}${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgrey}${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color lightgrey}${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
${color lightgrey}${top name 5} ${top pid 5} ${top cpu 5} ${top mem 5}
${color lightgrey}${top name 6} ${top pid 6} ${top cpu 6} ${top mem 6}
${color lightgrey}${top name 7} ${top pid 7} ${top cpu 7} ${top mem 7}
${color lightgrey}${top name 8} ${top pid 8} ${top cpu 8} ${top mem 8}
${color lightgrey}${top name 9} ${top pid 9} ${top cpu 9} ${top mem 9}
${color lightgrey}${top name 10} ${top pid 10} ${top cpu 10} ${top mem 10}
${color grey}Processes:${color yellow} $processes ${color grey}Running:${color yellow} $running_processes
]]
肥龙软件分享的软件是本站作者开发的免费,无广告,安全可靠,绝不附带任何无关软件,绝不困绑任何插件的实用软件。如果您感觉好用,可以捐赠我们,这样我们可以有更积极的动力去改进升级软件,维持服务器运转,感谢您的捐助,谢谢!
更新时间:2024.8.31