#1 Le 26/06/2010, à 10:46
- matef
Réseau et disque externe avec if_existing dans Conky
Bonjour,
D'abord, j'ai essayé de modifier mon conky afin qu'il s'adapte en fonction de ma méthode de connexion (filaire, sans fil ou pas de réseau) avec if_existing. Ça ne s'est pas trop mal passé, mais quand je n'ai pas de connexion il ne m'affiche pas : PAS DE RÉSEAU.
Ensuite, j'ai voulu faire de même pour faire apparaître mes disques externes dans mon conky lorsqu'ils sont présents.
Tout marche parfaitement sans if_existing mais dès que je l'ajoute: plus rien (à propos des disques externes) ne s'affiche dans conky.
Je n'arrive pas à saisir où sont mes erreurs...
À vot'bon coeur m'sieurs dames!
Voici mon conky:
use_xft yes
xftfont Sans Mono:size=10
xftalpha 0.8
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
##own_window_hints undecorated,below,skip_taskbar
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
background yes
double_buffer yes
minimum_size 220 5
draw_shades yes
draw_outline no
draw_borders no
stippled_borders 8
border_inner_margin 0
border_width 0
default_color white
default_shade_color black
default_outline_color black
alignment top_right
gap_x 10
gap_y 10
no_buffers yes
uppercase no
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes
use_spacer none
#min_port_monitors 0
#min_port_monitor_connections 0
TEXT
${color #707070}SYSTÈME $hr
${color white} $nodename allumé depuis $uptime ${color white}
${color white} ${exec cat /etc/lsb-release | grep DISTRIB_ID | cut -d = -f2} ${exec cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d = -f2} ${exec cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d = -f2} - $sysname $kernel
${color #707070}RESSOURCES $hr
${color white} Intel(R) Core(TM) i5 520M $freq_g GHz
#cat /proc/cpuinfo | grep model | cut -c14-
${color white} CPU1 [${exec sensors | grep "Core 0" | awk -F "+" '{print $2}' | awk -F ".0°" '{print $1}'} °C]:${color white} ${cpu cpu1}% ${alignr}${cpubar cpu1 8,264}
${color white} CPU2 [${exec sensors | grep "Core 1" | awk -F "+" '{print $2}' | awk -F ".0°" '{print $1}'} °C]:${color white} ${cpu cpu2}% ${alignr}${cpubar cpu2 8,264}
${color white} CPU3 [${exec sensors | grep "Core 2" | awk -F "+" '{print $2}' | awk -F ".0°" '{print $1}'} °C]:${color white} ${cpu cpu3}% ${alignr}${cpubar cpu3 8,264}
${color white} CPU4 [${exec sensors | grep "Core 3" | awk -F "+" '{print $2}' | awk -F ".0°" '{print $1}'} °C]:${color white} ${cpu cpu4}% ${alignr}${cpubar cpu4 8,264}
${color white} RAM: $mem/$memmax - $memperc% ${membar 8}
${color white} SWAP:$color $swap/$swapmax - $swapperc% ${swapbar 8}
${color #707070}RÉSEAU $hr${if_existing /proc/net/route eth0}
${color white} IP locale: ${color white}${offset 1} ${addr eth0}
${color white} IP publique: ${execi 3600 wget http://checkip.dyndns.org -O - -o /dev/null | cut -d : -f 2 | cut -d \< -f 1}
DOWN:${color white} ${downspeed eth0}/s $alignr UP:${color white} ${upspeed eth0}/s
${color white}${voffset -3} ${downspeedgraph eth0 42,186 FFFFFF FFFFFF} ${color white}${upspeedgraph eth0 42,186 FFFFFF FFFFFF}
${color white}${voffset -6} total: ${totaldown eth0} $alignr total: ${totalup eth0}${else}${if_existing /proc/net/route eth1}
${color white} IP locale: ${color white}${offset 1} ${addr eth1}
${color white} IP publique: ${execi 3600 wget http://checkip.dyndns.org -O - -o /dev/null | cut -d : -f 2 | cut -d \< -f 1}
DOWN:${color white} ${downspeed eth1}/s $alignr UP:${color white} ${upspeed eth1}/s
${color white}${voffset -3} ${downspeedgraph eth1 42,186 FFFFFF FFFFFF} ${color white}${upspeedgraph eth1 42,186 FFFFFF FFFFFF}
${color white}${voffset -6} total: ${totaldown eth1} $alignr total: ${totalup eth1}${else}${color red}${alignc}PAS DE RÉSEAU${endif}${endif}
${color #707070}STOCKAGE ${hr 1}
${color white} / ${fs_used /}/${fs_size /}${alignr}${fs_used_perc /}%
${color white} ${fs_bar 10 /}
${color white} /home ${fs_used /home}/${fs_size /home}${alignr}${fs_used_perc /home}%
${color white} ${fs_bar 10 /home}
${color white} /DATA ${fs_used /media/DATA}/${fs_size /media/DATA}${alignr}${fs_used_perc /media/DATA}%
${color white} ${fs_bar 10 /media/DATA}${if_existing /media/iomega alpha}
${color white} /iomega alpha ${fs_used /media/iomega alpha}/${fs_size /media/iomega alpha}${alignr}${fs_used_perc /media/iomega alpha}%
${color white} ${fs_bar 10 /media/iomega alpha}${endif}${if_existing /media/iomega beta}
${color white} /iomega beta ${fs_used /media/iomega beta}/${fs_size /media/iomega beta}${alignr}${fs_used_perc /media/iomega beta}%
${color white} ${fs_bar 10 /media/iomega beta}${endif}
${color #707070}PROCESSUS $hr
${color white}$alignr CPU
${color white} ${top name 1} $alignr${top cpu 1}%
${color white} ${top name 2} $alignr${top cpu 2}%
${color white} ${top name 3} $alignr${top cpu 3}%
${color white}$alignr RAM
${color white} ${top_mem name 1} $alignr${top_mem mem 1}%
${color white} ${top_mem name 2} $alignr${top_mem mem 2}%
${color white} ${top_mem name 3} $alignr${top_mem mem 3}%
Hors ligne
#2 Le 27/06/2010, à 18:28
- matef
Re : Réseau et disque externe avec if_existing dans Conky
J'ai résolu le problème pour la partie réseau comme ceci:
use_xft yes
xftfont Sans Mono:size=10
xftalpha 0.8
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
##own_window_hints undecorated,below,skip_taskbar
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
background yes
double_buffer yes
minimum_size 220 5
draw_shades yes
draw_outline no
draw_borders no
stippled_borders 8
border_inner_margin 0
border_width 0
default_color white
default_shade_color black
default_outline_color black
alignment top_right
gap_x 10
gap_y 10
no_buffers yes
uppercase no
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes
use_spacer none
#min_port_monitors 0
#min_port_monitor_connections 0
TEXT
${color #707070}SYSTÈME $hr
${color white} $nodename allumé depuis $uptime ${color white}
${color white} ${exec cat /etc/lsb-release | grep DISTRIB_ID | cut -d = -f2} ${exec cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d = -f2} ${exec cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d = -f2} - $sysname $kernel
${color #707070}RESSOURCES $hr
${color white} Intel(R) Core(TM) i5 520M $freq_g GHz
#cat /proc/cpuinfo | grep model | cut -c14-
${color white} CPU1 [${exec sensors | grep "Core 0" | awk -F "+" '{print $2}' | awk -F ".0°" '{print $1}'} °C]:${color white} ${cpu cpu1}% ${alignr}${cpubar cpu1 8,264}
${color white} CPU2 [${exec sensors | grep "Core 1" | awk -F "+" '{print $2}' | awk -F ".0°" '{print $1}'} °C]:${color white} ${cpu cpu2}% ${alignr}${cpubar cpu2 8,264}
${color white} CPU3 [${exec sensors | grep "Core 2" | awk -F "+" '{print $2}' | awk -F ".0°" '{print $1}'} °C]:${color white} ${cpu cpu3}% ${alignr}${cpubar cpu3 8,264}
${color white} CPU4 [${exec sensors | grep "Core 3" | awk -F "+" '{print $2}' | awk -F ".0°" '{print $1}'} °C]:${color white} ${cpu cpu4}% ${alignr}${cpubar cpu4 8,264}
${color white} RAM: $mem/$memmax - $memperc% ${membar 8}
${color white} SWAP:$color $swap/$swapmax - $swapperc% ${swapbar 8}
${color #707070}RÉSEAU $hr${if_existing /proc/net/route eth0}
${color white} IP locale: ${color white}${offset 1} ${addr eth0}
${color white} IP publique: ${execi 3600 wget http://checkip.dyndns.org -O - -o /dev/null | cut -d : -f 2 | cut -d \< -f 1}
DOWN:${color white} ${downspeed eth0}/s $alignr UP:${color white} ${upspeed eth0}/s
${color white}${voffset -3} ${downspeedgraph eth0 42,186 FFFFFF FFFFFF} ${color white}${upspeedgraph eth0 42,186 FFFFFF FFFFFF}
${color white}${voffset -6} total: ${totaldown eth0} $alignr total: ${totalup eth0}${else}${if_existing /proc/net/route eth1}
${color white} IP locale: ${color white}${offset 1} ${addr eth1}
${color white} IP publique: ${execi 3600 wget http://checkip.dyndns.org -O - -o /dev/null | cut -d : -f 2 | cut -d \< -f 1}
DOWN:${color white} ${downspeed eth1}/s $alignr UP:${color white} ${upspeed eth1}/s
${color white}${voffset -3} ${downspeedgraph eth1 42,186 FFFFFF FFFFFF} ${color white}${upspeedgraph eth1 42,186 FFFFFF FFFFFF}
${color white}${voffset -6} total: ${totaldown eth1} $alignr total: ${totalup eth1}${else}
${color red}${alignc}PAS DE RÉSEAU${endif}${endif}
${color #707070}STOCKAGE ${hr 1}
${color white} / ${fs_used /}/${fs_size /}${alignr}${fs_used_perc /}%
${color white} ${fs_bar 10 /}
${color white} /home ${fs_used /home}/${fs_size /home}${alignr}${fs_used_perc /home}%
${color white} ${fs_bar 10 /home}
${color white} /DATA ${fs_used /media/DATA}/${fs_size /media/DATA}${alignr}${fs_used_perc /media/DATA}%
${color white} ${fs_bar 10 /media/DATA}${if_existing /media/iomega alpha}
${color white} /iomega alpha ${fs_used /media/iomega alpha}/${fs_size /media/iomega alpha}${alignr}${fs_used_perc /media/iomega alpha}%
${color white} ${fs_bar 10 /media/iomega alpha}${endif}${if_existing /media/iomega beta}
${color white} /iomega beta ${fs_used /media/iomega beta}/${fs_size /media/iomega beta}${alignr}${fs_used_perc /media/iomega beta}%
${color white} ${fs_bar 10 /media/iomega beta}${endif}
${color #707070}PROCESSUS $hr
${color white}$alignr CPU
${color white} ${top name 1} $alignr${top cpu 1}%
${color white} ${top name 2} $alignr${top cpu 2}%
${color white} ${top name 3} $alignr${top cpu 3}%
${color white}$alignr RAM
${color white} ${top_mem name 1} $alignr${top_mem mem 1}%
${color white} ${top_mem name 2} $alignr${top_mem mem 2}%
${color white} ${top_mem name 3} $alignr${top_mem mem 3}%
Par contre, je ne comprend toujours pas pourquoi mes disques externes montés dans /media n'apparaissent pas dans conky...
Personne n'a d'idée?
Hors ligne