Desktop environment with Conky

Guides and tutorials for various stuff. Posted by DietPi users.
alessandro.psrt
Posts: 16
Joined: Tue Dec 06, 2016 1:34 pm

Desktop environment with Conky

Post by alessandro.psrt » Fri Jan 06, 2017 12:18 am

I share this post hoping be useful to someone.

Thanks to dietpi I turned my ODROID into a mini server very useful. Having few hardware resources is important to keep them under control and Conky can help you do that. Internet is full of how-to for conky but non always working with different distros/configs, so:

assuming you connect to session via remote desktop with a non-root user, these commands are from root user

install conky and create config file

Code: Select all

apt-get install conky-all
nano ~/.conkyrc
Paste into it

Code: Select all

background yes
double_buffer yes

alignment top_left

border_width 1
cpu_avg_samples 2
default_color white
default_outline_color white
default_shade_color white
draw_borders no
draw_graph_borders yes
draw_outline no
draw_shades no

gap_x 10
gap_y 10
net_avg_samples 2
no_buffers yes
out_to_console no
out_to_stderr no
extra_newline nosa

own_window yes
own_window_type normal
own_window_transparent yes
own_window_colour 000000
own_window_argb_visual no
own_window_argb_value 0
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

minimum_size 220 600
stippled_borders 0
update_interval 2.0
uppercase no
use_spacer none

show_graph_scale no
show_graph_range no

use_xft yes
xftalpha 0.1
xftfont Sans:style=Bold:size=10
color0 white
color1 EAEAEA
color2 FFA300
color3 grey
color4 red

TEXT

${font Sans:style=Bold:size=11}$alignc${color2}DietPi @ OdroidC1+

${font Sans:style=Normal:size=8}${color2}Kernel${color0}${alignr}${kernel}
${color2}Uptime${color0}${alignr}${uptime}${font Sans:style=Bold:size=10}

${color2}Utilizzo CPU${color0}${alignr}${cpu cpu0}%
${cpubar cpu0 5,}
${cpubar cpu1 5,}
${cpubar cpu2 5,}
${cpubar cpu3 5,}
${font Sans:style=Normal:size=8}${top name 1} $alignr ${top cpu 1}%
${top name 2} $alignr ${top cpu 2}%
${top name 3} $alignr ${top cpu 3}%
${top name 4} $alignr ${top cpu 4}%
${top name 5} $alignr ${top cpu 5}%${font Sans:style=Bold:size=10}

${color2}Utilizzo RAM${color0}${alignr}${mem}
${membar 5,}
${font Sans:style=Normal:size=8}${top_mem name 1} $alignr ${top_mem mem_res 1}
${top_mem name 2} $alignr ${top_mem mem_res 2}
${top_mem name 3} $alignr ${top_mem mem_res 3}
${top_mem name 4} $alignr ${top_mem mem_res 4}
${top_mem name 5} $alignr ${top_mem mem_res 5}${font Sans:style=Bold:size=10}

${color2}Utilizzo eMMC${color0}${alignr}${fs_used /}
${fs_bar /}
${font Sans:style=Normal:size=8}${color2}Lettura${color0}${alignr}${diskio_read mmcblk0}
${color2}Scrittura${color0}${alignr}${diskio_write mmcblk0}${font Sans:style=Bold:size=10}

${color2}Internet${alignr}${color0}${execpi 10 ~/.pingtest.sh}
${font Sans:style=Normal:size=8}${color2}${execi 600 cat ~/.speedtest.result }${font Sans:style=Bold:size=10}

${color2}Download ${color0}${alignr}${downspeedf eth1} KiB/s
${downspeedgraph eth1 40,}
${color2}Upload ${color0}${alignr}${upspeedf eth1} KiB/s 
${upspeedgraph eth1 40,}
${font Sans:style=Normal:size=8}${color2}IP Locale${color0}${alignr}${addr eth1}
${color2}IP Pubblico${color0}${alignr}${execi 3600 wget -q -O /dev/stdout http://checkip.dyndns.org/ | cut -d : -f 2- | cut -d \< -f -1}
${color2}No-Ip${color0}${alignr}${execi 3600 ping -c 1 yourdomain.ddns.net | perl -e '$header=<>;$header=~m/ \(([^)]+)\) /;print $1;'}${font Sans:style=Bold:size=10}
Install speedtest-cli

Code: Select all

apt-get install speedtest-cli
Create cronjob that write speedtest results into text file. You can skip this step and pass this command directly to conky but I think this method is better

Code: Select all

crontab -e
and paste

Code: Select all

30 * * * * speedtest-cli --simple > ~/.speedtest.result
this create a text file with results and overwrite it every 30 minutes

Create a script to ping google and test connection

Code: Select all

nano ~/.pingtest.sh
and paste

Code: Select all

#!/bin/bash

if ping -c 1 -W 2 www.google.it > /dev/null; then
	echo "Online"
else
    echo "Offline"
fi
Now launching conky everything must work fine. Every text entry could be edit, english, spanish or alien languages :D in .conkyrc config file. You can also add or remove functions. Be sure that mmcblk0, eth1 and other variables are right for your config. Screenshot preview attached.

Sorry for any error (I'm a newbie), I am available for any questions or explanations.
Attachments
2017-01-05-115931_1366x768_scrot.png

User avatar
Fourdee
Site Admin
Posts: 2744
Joined: Tue Feb 06, 2007 12:36 pm

Re: Desktop environment with Conky

Post by Fourdee » Fri Jan 06, 2017 5:55 pm

alessandro.psrt wrote:I share this post hoping be useful to someone.

Thanks to dietpi I turned my ODROID into a mini server very useful. Having few hardware resources is important to keep them under control and Conky can help you do that. Internet is full of how-to for conky but non always working with different distros/configs, so:

assuming you connect to session via remote desktop with a non-root user, these commands are from root user
Very nice, thanks for sharing!

I did see your tweet for this, love the system stats on Conky. I'll have to try this out and maybe we can add it to the dietpi-software catalogue, based on your guide :)
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal and Bitcoin.

alessandro.psrt
Posts: 16
Joined: Tue Dec 06, 2016 1:34 pm

Re: Desktop environment with Conky

Post by alessandro.psrt » Sat Jan 07, 2017 12:36 am

Thank you for DietPi, time and passion!

Can also be useful logo, temperature and notifier for updates from dietpi-update.
Examples from an Archlinux installation:

Code: Select all

${alignc}${image ./archlinux.png -s 200x150}
${color2}Temperatura${color0}${alignr}${execi 1 sensors | grep "Physical id 0" | cut -d "+" -f2 | cut -c1-6}
${color2}Update disponibili${color0}${alignr} ${execpi 10 ~/.checkupdates.sh}
.checkupdates.sh

Code: Select all

#!/bin/bash

if ping -c 1 -W 2 www.google.it > /dev/null; then
        checkupdates | wc -l # change with something like dietpi-update | grep "Server Version" | cut xyz
else
    echo "Updated"
I think DietPi need an official Wallpaper! Something like this attachment, simply but cool ;)
Attachments
dietpi-wallpaper.jpg

alessandro.psrt
Posts: 16
Joined: Tue Dec 06, 2016 1:34 pm

Re: Desktop environment with Conky

Post by alessandro.psrt » Sat Jan 07, 2017 7:08 am

Found an ugly but working method to notify dietpi-update in conky:

script to create /tmp/dietpi-update/server_version and copying version number into ~/.server_version (from dietpi-update script, sure contain unused functions, sorry but I'm not a coder :roll: )

Code: Select all

nano ~/.dietpi-update-checker
and paste

Code: Select all

#!/bin/bash
#Load the whole script into memory.
{
	#////////////////////////////////////
	# DietPi Update
	#
	#////////////////////////////////////
	# Created by Daniel Knight / daniel.knight@dietpi.com / dietpi.com
	#
	#////////////////////////////////////
	#
	# Info:
	# - Updates DietPi from Git
	# - Uses patch_file for online pactching
	#
	# Usage:
	# - dietpi-update   = Normal
	# - dietpi-update 1 = forced update
	# - dietpi-update 2 = Check for updates. print server_version to /DietPi/dietpi/.update_available (-1=new image required)
	#////////////////////////////////////

	#Force en_GB Locale for whole script. Prevents incorrect parsing with non-english locales.
	LANG=en_GB.UTF-8

	#/////////////////////////////////////////////////////////////////////////////////////
	#GIT Branch | master / testing
	#/////////////////////////////////////////////////////////////////////////////////////
	GITBRANCH=$(cat /DietPi/dietpi.txt | grep -m1 '^gitbranch=' | sed 's/.*=//')
	GITFORKOWNER=$(cat /DietPi/dietpi.txt | grep -m1 '^gitforkowner=' | sed 's/.*=//')

	#/////////////////////////////////////////////////////////////////////////////////////
	#UPDATE Vars
	#/////////////////////////////////////////////////////////////////////////////////////
	DIETPIUPDATE_VERSION_CURRENT=5 # Version of dietpi-update / set server_version line two to value++ and obsolete previous dietpi-update scripts
	DIETPIUPDATE_VERSION_REQUIRED=0

	FILEPATH_TEMP="/tmp/dietpi-update-checker"

	SERVER_ONLINE=0
	UPDATE_AVAILABLE=0
	UPDATE_REQUIRESNEWIMAGE=0
	RUN_UPDATE=0

	VERSION_CURRENT=0
	VERSION_SERVER=0

	URL_MIRROR_INDEX=0
	URL_MIRROR_SERVERVERSION=(

		"http://dietpi.com/downloads/dietpi-update_mirror/$GITBRANCH/server_version"
		"https://raw.githubusercontent.com/${GITFORKOWNER:-Fourdee}/DietPi/$GITBRANCH/dietpi/server_version"

	)

	URL_MIRROR_ZIP=(

		"http://dietpi.com/downloads/dietpi-update_mirror/$GITBRANCH/DietPi-$GITBRANCH.zip"
		"https://github.com/${GITFORKOWNER:-Fourdee}/DietPi/archive/$GITBRANCH.zip"

	)

	Get_Client_Version(){
		VERSION_CURRENT=$(cat /DietPi/dietpi/.version)
	}

	Get_Server_Version(){

		#Get server version file
		for ((i=0; i<${#URL_MIRROR_SERVERVERSION[@]}; i++))
		do

			URL_MIRROR_INDEX=$i

			/DietPi/dietpi/func/dietpi-notify 2 #"Checking Mirror : ${URL_MIRROR_SERVERVERSION[$i]}"
			curl -k -L ${URL_MIRROR_SERVERVERSION[$i]} > "$FILEPATH_TEMP"/server_version
			if (( $? == 0 )); then

				#Get server Version info
				VERSION_SERVER=$(sed -n 1p "$FILEPATH_TEMP"/server_version)
				DIETPIUPDATE_VERSION_REQUIRED=$(sed -n 2p "$FILEPATH_TEMP"/server_version)

				#Check if server_version is a valid interger.
				if [[ $VERSION_SERVER =~ ^-?[0-9]+$ ]]; then

					SERVER_ONLINE=1
					/DietPi/dietpi/func/dietpi-notify 0 #"Using update server: ${URL_MIRROR_SERVERVERSION[$i]}"

					break

				else

					/DietPi/dietpi/func/dietpi-notify 2 #"Invalid server version and/or update file unavailable"

				fi

			else

				/DietPi/dietpi/func/dietpi-notify 2 #"No response from: ${URL_MIRROR_SERVERVERSION[$i]}"

			fi

		done
	}

	Check_Update_Available(){

		#Server online?
		if (( $SERVER_ONLINE )); then

			#Update Requires new image?
			if (( $DIETPIUPDATE_VERSION_CURRENT < $DIETPIUPDATE_VERSION_REQUIRED )); then

				UPDATE_REQUIRESNEWIMAGE=1

			#Update available
			elif (( $VERSION_CURRENT < $VERSION_SERVER )); then

				UPDATE_AVAILABLE=1
				echo -e ""
				/DietPi/dietpi/func/dietpi-notify 0 "Update available"
				/DietPi/dietpi/func/dietpi-notify 2 "Current Version : $VERSION_CURRENT"
				/DietPi/dietpi/func/dietpi-notify 2 "Server Version  : $VERSION_SERVER"

			fi

		else

			/DietPi/dietpi/func/dietpi-notify 1 "Unable to access update servers. Please check your connection, then run dietpi-update again."
			exit

		fi

	}

	#/////////////////////////////////////////////////////////////////////////////////////
	# MENUS
	#/////////////////////////////////////////////////////////////////////////////////////
	WHIP_BACKTITLE='- DietPi-Update -'
	WHIP_TITLE=$WHIP_BACKTITLE
	CHOICE=0
	OPTION=0

	Menu_Update(){

		whiptail --title "$WHIP_TITLE" --yesno "Update available   : https://goo.gl/G9ikqn
Installed version  : $VERSION_CURRENT
Latest version     : $VERSION_SERVER

---------------------------------Notice-------------------------------------
The benefit of DietPi is we use standard linux configurations and commands. The downside is we can't possibly accommodate or predict, every modifcation to Linux configurations files by the end user, during the update.

Although we test the updates thoroughly, if you have made custom changes to Linux configuration files, outside of the DietPi programs, we highly recommend you create a backup of your system, before updating.

You can create a system backup, by running:
 - dietpi-backup
----------------------------------------------------------------------------

Do you wish to continue and update DietPi to v$VERSION_SERVER?" --yes-button "Ok" --no-button "Exit" --defaultno --backtitle "$WHIP_BACKTITLE" 24 80
		CHOICE=$?
		#Confirm action
		if (( $CHOICE == 0 )); then
			RUN_UPDATE=1
		fi
	}

	#/////////////////////////////////////////////////////////////////////////////////////
	# Update DietPi
	#/////////////////////////////////////////////////////////////////////////////////////

	

	#/////////////////////////////////////////////////////////////////////////////////////
	# Main Loop
	#/////////////////////////////////////////////////////////////////////////////////////
	#----------------------------------------------------------------
	#Inform user
	/DietPi/dietpi/func/dietpi-notify 3 DietPi-Update "Checking for DietPi updates"
	#----------------------------------------------------------------
	#Create temp directory used in dietpi-update
	rm -R "$FILEPATH_TEMP" &> /dev/null
	mkdir -p "$FILEPATH_TEMP" &> /dev/null
	#----------------------------------------------------------------
	#Get versions
	Get_Client_Version
	Get_Server_Version
	#----------------------------------------------------------------
	#Check if update is available
	Check_Update_Available
	#----------------------------------------------------------------
	#Check for updates only. Send result to global file for use by dietpi-banner update available notifications.

		#Clear previous .update_available file
		rm /DietPi/dietpi/.update_available &> /dev/null

		#Write update available version to file.
		if (( $UPDATE_AVAILABLE == 1 )); then

			echo -e "$VERSION_SERVER" > /DietPi/dietpi/.update_available

		elif (( $UPDATE_REQUIRESNEWIMAGE == 1 )); then

			echo -e "-1" > /DietPi/dietpi/.update_available

	#----------------------------------------------------------------
	#Run menus / prompts / updates
	else

		#----------------------------------------------------------------
		#Server offline
		if (( $SERVER_ONLINE == 0 )); then

			whiptail --title "Error - Server Offline" --msgbox "http://github.com is either offline, or, unable to connect \n \n No updates applied." 12 60

		#Update requires new DietPi image
		elif (( $UPDATE_REQUIRESNEWIMAGE == 1 )); then

			#Cannot update, Image required
			whiptail --title "New image required" --msgbox " Your version of DietPi is now obsolete and cannot be updated. \n\n Please download the latest DietPi image:\n - http://dietpi.com/downloads/images \n\n - Current Version : $VERSION_CURRENT \n - Server Version  : $VERSION_SERVER \n " 13 70

			/DietPi/dietpi/func/dietpi-notify 1 "Your version of DietPi is now obsolete and cannot be updated."
			echo -e "Please download the latest DietPi image:\n - http://dietpi.com/download \n\n - Current Version : $VERSION_CURRENT \n - Server Version  : $VERSION_SERVER \n "

		#Update available
		elif (( $UPDATE_AVAILABLE == 1 )); then

			#Forced update
			if (( $INPUT == 1 )); then

				/DietPi/dietpi/func/dietpi-notify 0 "Updates have been found and are being applied, please wait..."
				/DietPi/dietpi/func/dietpi-notify 2 "Current Version : $VERSION_CURRENT"
				/DietPi/dietpi/func/dietpi-notify 2 "Server Version  : $VERSION_SERVER"

				/DietPi/dietpi/dietpi-funtime 0

				RUN_UPDATE=1

			#Ask for update
			else

				Menu_Update

			fi

		#No Updates
		else

			echo -e ""
			/DietPi/dietpi/func/dietpi-notify 0 "No updates required, your DietPi installation is up to date.\n"
			/DietPi/dietpi/func/dietpi-notify 2 "Current Version : $VERSION_CURRENT"
			/DietPi/dietpi/func/dietpi-notify 2 "Server Version  : $VERSION_SERVER"

		fi

	
	fi

	unset URL_MIRROR_ZIP
	unset URL_MIRROR_ZIP
	
	head -1 /tmp/dietpi-update-checker/server_version > ~/.server_version
	exit

}
create a script readable from conky, it compare version and server_version

Code: Select all

nano ~/.dietpi-update-comparison
and paste

Code: Select all

#!/bin/bash

if ! cmp ~/.server_version /DietPi/dietpi/.version >/dev/null 2>&1
then
   echo "Update available"
else 
	echo "DietPi Updated"
fi

rm -rf /tmp/dietpi-update-checker
add to conky

Code: Select all

${color2}Update${color0}${alignr}${execpi 10 ~/.dietpi-update-comparison}
create cronjob

Code: Select all

crontab -e
and paste

Code: Select all

    60 * * * * speedtest-cli --simple > ~/.dietpi-update-checker
Attachments
updated.png
updated.png (5.92 KiB) Viewed 4221 times
available.png
available.png (5.91 KiB) Viewed 4221 times

User avatar
Fourdee
Site Admin
Posts: 2744
Joined: Tue Feb 06, 2007 12:36 pm

Re: Desktop environment with Conky

Post by Fourdee » Sat Jan 07, 2017 1:52 pm

Nice, I think this could be simplify by using the following:

Code: Select all

/DietPi/dietpi/dietpi-update 2
This creates a file in /DietPi/dietpi/.update_available, which contains the latest version number. If the file doesnt exist, an update is not available.

Example:

Code: Select all

/DietPi/dietpi/dietpi-update 2

#Check if we have an update available file (if no file, no updates available)
if [ -f /DietPi/dietpi/.update_available ]; then

    version_available=$(cat /DietPi/dietpi/.update_available)
    echo -e "$version_available is available for update"
    update_available=1

fi
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal and Bitcoin.

User avatar
Fourdee
Site Admin
Posts: 2744
Joined: Tue Feb 06, 2007 12:36 pm

Re: Desktop environment with Conky

Post by Fourdee » Sat Jan 07, 2017 1:56 pm

I think DietPi need an official Wallpaper! Something like this attachment, simply but cool
Wallpaper would be sweet, maybe we should have a competition? :D

Heres the current logo, 2048x2048: http://dietpi.com/images/dietpi-logo.png
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal and Bitcoin.

alessandro.psrt
Posts: 16
Joined: Tue Dec 06, 2016 1:34 pm

Re: Desktop environment with Conky

Post by alessandro.psrt » Mon Jan 09, 2017 11:01 am

Sure, but a friendly competition :) Thank you, how i can get it transparent?

alessandro.psrt
Posts: 16
Joined: Tue Dec 06, 2016 1:34 pm

Re: Desktop environment with Conky

Post by alessandro.psrt » Mon Jan 09, 2017 11:08 am

Fourdee wrote:Nice, I think this could be simplify by using the following:

Code: Select all

/DietPi/dietpi/dietpi-update 2
This creates a file in /DietPi/dietpi/.update_available, which contains the latest version number. If the file doesnt exist, an update is not available.

Example:

Code: Select all

/DietPi/dietpi/dietpi-update 2

#Check if we have an update available file (if no file, no updates available)
if [ -f /DietPi/dietpi/.update_available ]; then

    version_available=$(cat /DietPi/dietpi/.update_available)
    echo -e "$version_available is available for update"
    update_available=1

fi
Thank you again, I found something about it in dietpi-software code but I missed '2' argument.

rothchild
Posts: 66
Joined: Sat Jun 27, 2015 9:39 am

Re: Desktop environment with Conky

Post by rothchild » Tue Jan 10, 2017 4:25 pm

I always liked the conky setups that the CrunchBang community used to do (indeed the whole crunchbang desktop experience with OpenBox was great IMO).

Looks like it's forked in to two projects now

https://crunchbangplusplus.org/

https://www.bunsenlabs.org/

Might be good for some inspiration though.

tatxen
Posts: 3
Joined: Sun Jan 22, 2017 9:23 pm
Location: Spain

Re: Desktop environment with Conky

Post by tatxen » Sun Jan 22, 2017 11:18 pm

alessandro.psrt wrote:I share this post hoping be useful to someone.

Thanks to dietpi I turned my ODROID into a mini server very useful. Having few hardware resources is important to keep them under control and Conky can help you do that. Internet is full of how-to for conky but non always working with different distros/configs, so:

assuming you connect to session via remote desktop with a non-root user, these commands are from root user

install conky and create config file

Code: Select all

apt-get install conky-all
nano ~/.conkyrc
Paste into it

Code: Select all

background yes
double_buffer yes

alignment top_left

border_width 1
cpu_avg_samples 2
default_color white
default_outline_color white
default_shade_color white
draw_borders no
draw_graph_borders yes
draw_outline no
draw_shades no

gap_x 10
gap_y 10
net_avg_samples 2
no_buffers yes
out_to_console no
out_to_stderr no
extra_newline nosa

own_window yes
own_window_type normal
own_window_transparent yes
own_window_colour 000000
own_window_argb_visual no
own_window_argb_value 0
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

minimum_size 220 600
stippled_borders 0
update_interval 2.0
uppercase no
use_spacer none

show_graph_scale no
show_graph_range no

use_xft yes
xftalpha 0.1
xftfont Sans:style=Bold:size=10
color0 white
color1 EAEAEA
color2 FFA300
color3 grey
color4 red

TEXT

${font Sans:style=Bold:size=11}$alignc${color2}DietPi @ OdroidC1+

${font Sans:style=Normal:size=8}${color2}Kernel${color0}${alignr}${kernel}
${color2}Uptime${color0}${alignr}${uptime}${font Sans:style=Bold:size=10}

${color2}Utilizzo CPU${color0}${alignr}${cpu cpu0}%
${cpubar cpu0 5,}
${cpubar cpu1 5,}
${cpubar cpu2 5,}
${cpubar cpu3 5,}
${font Sans:style=Normal:size=8}${top name 1} $alignr ${top cpu 1}%
${top name 2} $alignr ${top cpu 2}%
${top name 3} $alignr ${top cpu 3}%
${top name 4} $alignr ${top cpu 4}%
${top name 5} $alignr ${top cpu 5}%${font Sans:style=Bold:size=10}

${color2}Utilizzo RAM${color0}${alignr}${mem}
${membar 5,}
${font Sans:style=Normal:size=8}${top_mem name 1} $alignr ${top_mem mem_res 1}
${top_mem name 2} $alignr ${top_mem mem_res 2}
${top_mem name 3} $alignr ${top_mem mem_res 3}
${top_mem name 4} $alignr ${top_mem mem_res 4}
${top_mem name 5} $alignr ${top_mem mem_res 5}${font Sans:style=Bold:size=10}

${color2}Utilizzo eMMC${color0}${alignr}${fs_used /}
${fs_bar /}
${font Sans:style=Normal:size=8}${color2}Lettura${color0}${alignr}${diskio_read mmcblk0}
${color2}Scrittura${color0}${alignr}${diskio_write mmcblk0}${font Sans:style=Bold:size=10}

${color2}Internet${alignr}${color0}${execpi 10 ~/.pingtest.sh}
${font Sans:style=Normal:size=8}${color2}${execi 600 cat ~/.speedtest.result }${font Sans:style=Bold:size=10}

${color2}Download ${color0}${alignr}${downspeedf eth1} KiB/s
${downspeedgraph eth1 40,}
${color2}Upload ${color0}${alignr}${upspeedf eth1} KiB/s 
${upspeedgraph eth1 40,}
${font Sans:style=Normal:size=8}${color2}IP Locale${color0}${alignr}${addr eth1}
${color2}IP Pubblico${color0}${alignr}${execi 3600 wget -q -O /dev/stdout http://checkip.dyndns.org/ | cut -d : -f 2- | cut -d \< -f -1}
${color2}No-Ip${color0}${alignr}${execi 3600 ping -c 1 yourdomain.ddns.net | perl -e '$header=<>;$header=~m/ \(([^)]+)\) /;print $1;'}${font Sans:style=Bold:size=10}
Install speedtest-cli

Code: Select all

apt-get install speedtest-cli
Create cronjob that write speedtest results into text file. You can skip this step and pass this command directly to conky but I think this method is better

Code: Select all

crontab -e
and paste

Code: Select all

30 * * * * speedtest-cli --simple > ~/.speedtest.result
this create a text file with results and overwrite it every 30 minutes

Create a script to ping google and test connection

Code: Select all

nano ~/.pingtest.sh
and paste

Code: Select all

#!/bin/bash

if ping -c 1 -W 2 www.google.it > /dev/null; then
	echo "Online"
else
    echo "Offline"
fi
Now launching conky everything must work fine. Every text entry could be edit, english, spanish or alien languages :D in .conkyrc config file. You can also add or remove functions. Be sure that mmcblk0, eth1 and other variables are right for your config. Screenshot preview attached.

Sorry for any error (I'm a newbie), I am available for any questions or explanations.
According to the Conky documentation, the "cpubar" object with the "cpu0" argument would correspond to the total load and not to the first core
http://conky.sourceforge.net/docs.html
"cpu (cpuN)
CPU usage in percents. For SMP machines, the CPU number can be provided as an argument. ${cpu cpu0} is the total usage, and ${cpu cpuX} (X >= 1) are individual CPUs.
cpubar (cpuN) (height),(width)
Bar that shows CPU usage, height is bar's height in pixels. See $cpu for more info on SMP."

Post Reply