Conky - Init-System anzeigen  [Solved]

Message
Author
loik
Posts: 2278
Joined: Wed Dec 12, 2018 2:01 pm

Conky - Init-System anzeigen

#1 Post by loik »

Hallo, Forum.

Ich hatte mal wieder eine Bastelidee.
Ich möchte gerne, dass in meinem Lieblings-Conky ( Asq-MX-GeekyTowerLogo ) angezeigt wird, welches Init-System gerade läuft.

Fänd ich chic, wenn es so ausdruckstark, deutlich machbar wäre, wie es im QSI zu sehen ist.
Init: systemd
oder eben
Init: SysVinit

Das habe ich aber nicht hinbekommen.
Halt nur so ansatzweise.

Ist zwar durchaus informativ, sieht aber voll doof aus.
Conky SystemD.png


für SysVinit ist es noch bekloppter.
Conky SysVinit.png

Mein misslungener Hack dazu, sieht so aus:

Code: Select all

${color2}SYSTEM ${hr 2}${color}

   ${image MXLogoStart.png -p 97,90 -s 50x50}
   
  

 ${alignc}${color1}${execi 3600 cat /etc/mx-version}

${voffset 2}${color3}   Kernel: ${alignr}${color}${kernel}
   ${color3}Init-System: ${alignr}${color}${execi 3600 ps 1}
   
   ${color3}Uptime: ${alignr}${color}${uptime}

   ${color3}CPU: ${color}${cpu cpu0}% ${alignr}${color4}${cpubar cpu0 8,60}

   ${color3}RAM: ${color}$mem / $memmax   -> $memperc% ${alignr}${color4}${membar 8,60}

   ${color3}SWAP: ${color}$swap / $swapmax   -> $swapperc% ${alignr}${color4}${swapbar 8,60}
   
Mein Ziel, war es, dass es in der Darstellung im Conky etwa so aussieht, wie bei der Zeile "Uptime"

Nur statt Uptime eben "init-System" und am Zeilenende natürlich nicht die Zeit sondern SystenD oder SysVinit,
Je nach dem, was gerade geladen ist.


Von all meinen ahnungslosen Versuchen ist das hier gezeigte Ergebnis das beste. :bawling:


Wie macht man es richtig ?
You do not have the required permissions to view the files attached to this post.

User avatar
fehlix
Developer
Posts: 12899
Joined: Wed Apr 11, 2018 5:09 pm

Re: Conky - Init-System anzeigen

#2 Post by fehlix »

Ich habe sowas in einem conky drinn:

Code: Select all

${no_update ${if_existing /run/systemd/system}systemd${else}SysVinit${endif}}
sieht dann so aus:
conky-uefi-bios-init-kernel.jpg
Die Zeilen am Ende vom MX-Cowon-Tangram conky sehen so aus:

Code: Select all

#system
${offset 0}${voffset 190}\
${font Roboto-Light:bold:pixelsize=14}${offset 12}${color3}${no_update ${if_existing /sys/firmware/efi}UEFI${else}BIOS${endif}} \
${offset 2}${color4}\
${font RobotoMono-Light:bold:pixelsize=12}${no_update ${if_existing /run/systemd/system}systemd${else}SysVinit${endif}}
#system
${offset 0}${voffset 2}\
${font Roboto-Light:bold:pixelsize=14}${offset 12}${color1}Kernel: ${no_update $kernel} \
You do not have the required permissions to view the files attached to this post.

loik
Posts: 2278
Joined: Wed Dec 12, 2018 2:01 pm

Re: Conky - Init-System anzeigen  [Solved]

#3 Post by loik »

Herrlich !
Wie in meinen Träumen.
Conky SystemD - wie gewünscht.png
Conky SysVinit - wie gewünscht.png
Deine angebotenen Zeile habe ich bei mir auf diese Weise eingefügt:

Code: Select all

  

 ${alignc}${color1}${execi 3600 cat /etc/mx-version}

${voffset 2}${color3}   Kernel: ${alignr}${color}${kernel}
   ${color3}Init-System: ${alignr}${color}${if_existing /run/systemd/system}SystemD${else}SysVinit${endif}
   
   ${color3}Uptime: ${alignr}${color}${uptime}

   ${color3}CPU: ${color}${cpu cpu0}% ${alignr}${color4}${cpubar cpu0 8,60}

   ${color3}RAM: ${color}$mem / $memmax   -> $memperc% ${alignr}${color4}${membar 8,60}

   ${color3}SWAP: ${color}$swap / $swapmax   -> $swapperc% ${alignr}${color4}${swapbar 8,60}

Code: Select all

${no_update
in dieses Script mit rein zunehmen hatte für mich keinen Sinn ergeben.
Ich habe es deshalb auch gar nicht versucht.

Ist nun alles genau so wie ich es mir vorgestellt hatte.

Danke, Fehlix.
You do not have the required permissions to view the files attached to this post.

User avatar
i_ri
Posts: 1136
Joined: Tue Jun 30, 2015 12:26 am

Re: Conky - Init-System anzeigen

#4 Post by i_ri »

Code: Select all

	init  ${pid_cmdline 1}
	${if_match "${pid_cmdline 1}"=="/lib/systemd/systemd"}SystemD ${else}SysVinit ${endif} MX

loik
Posts: 2278
Joined: Wed Dec 12, 2018 2:01 pm

Re: Conky - Init-System anzeigen

#5 Post by loik »

Hallo, i_ri.

Danke.
Deine erste Zeile, erinnert an meine Eigenversuche, ist aber deutlich besser.

Deine zweite Zeile finde ich sehr gut.
Sie führt zum selben gewünschten Ergebnis, wie Fehlixs Lösung.

Ich habe deinen Vorschlag bei mir, für "Asq-MX-GeekyTowerLogo", auf diese Weise nutzen können:

Code: Select all

${color3}Init-System: ${alignr}${color}${if_match "${pid_cmdline 1}"=="/lib/systemd/systemd"}SystemD-Shim ${else}SysVinit ${endif} MX

User avatar
i_ri
Posts: 1136
Joined: Tue Jun 30, 2015 12:26 am

Re: Conky - Init-System anzeigen

#6 Post by i_ri »

Yes. fehlix teaches us. Thank You fehlix.

Post Reply

Return to “Deutsches Forum”