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.
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.
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
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: