4
0
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.
4
0
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.
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
0
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:
1you can also specify the execution interval by using:
execi <seconds> your_script.sh
– ma3oun – 2019-10-18T20:27:23.743
Not sure about Conky, but for server monitoring I like to use Monit and have a detailed answer on how I implement it for Apache web servers over here. Whether it can be used for non-system daemon processes? I don’t know. But just an idea.
– JakeGould – 2015-03-06T06:15:44.060