6

The Bash script I’d like to run in Conky is a loop so only needs to be run once. It’s a monitoring script in case my VoIP router goes down.

${execi 3600 /home/justin/pingvoip}

Conky doesn’t want to start with the above code.

0

2 Answers 2

4

I've worked around the problem by having the script output to a log file and I have conky tail the log file.

For anyone who wanted to see the script:

#!/bin/bash
rm /home/username/ping.log #deletes the log file when the script starts
downTime=0
lastAccessTime=$(date +"%s")
while [ true ]; do
if ! ping -c1 192.168.1.28 >& /dev/null; then
    downTime=$(( $(date +"%s") - $lastAccessTime ))
else
    downTime=0
    lastAccessTime=$(date +"%s")

fi

sleep 60

if [ $downTime -ge 60 ]; then
   notify-send -u normal "VoIP is down! Please Reboot." #displays a desktop notification
   mplayer -nolirc -really-quiet /home/username/chime.ogg #plays a sound
   echo "`date +%b%e,%l:%M%p` $1": "VoIP is down!" >>/home/username/ping.log #writes Date & text to the log file
fi


done
4

The way to do this is through the conky command/variables such as exec,execp, execi, pre_exec,execbar, and execgraph.

Just like any other conky variable, only followed by bash -

${pre_exec ls -flah}

or

${exec your_script.sh} 

Keep in mind that all of these - except for execi and pre_exec will run every time conky 'ticks' - which can be very resource consuming, depending on your script.

See the complete list and more information in the list of Conky objects:

1
  • 3
    you can also specify the execution interval by using: execi <seconds> your_script.sh
    – ma3oun
    Oct 18, 2019 at 20:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .