Hi,
I don't know if this is really the right place to put this but I find this little tweak I do quite handy.
As far as I can see the current "version" is about useless for the general world. It gives information that would only be used to for working on a problem. I work on a lot of problems, but my short term memory sort of sucks a little so I use "version" to help me along the way.
I do several things to Cecil's original ver.sh so that It will help me when I need a memory prompt.
First, I add two lines to /usr/local/bin/mythbackup
#!/bin/bash
echo -n "Last Backup was on ">/home/mythtv/lbu.txt
date >>/home/mythtv/lbu.txt
Then I add a line to /etc/X11/fluxbox/keys
echo "
Mod1 v :ExecCommand ver.sh" >>/etc/X11/fluxbox/keys
Put in an entry into mythtv crontab
# Daily Drive space checkup
0 20 * * * sh /usr/bin/run-space-check.sh &>/dev/null
And add a modified (original was posted on forum somewhere) script called /usr/bin/run-space-check.sh
Code:
#!/bin/sh
# Drive space warning script
#-------------------------------------------------------------
lsmod |grep "ivtvfb "|cut -b1-6 >/tmp/tv
if [ "$(cat /tmp/tv)" = "ivtvfb" ]; then
fontsize="25"
fontcolor="lightyellow"
else
fontsize="34"
fontcolor="yellow"
fi
export DISPLAY=:0
export FONT="-adobe-helvetica-bold-*-*-*-$fontsize-*-*-*-*-*-*-*"
#----------------------------------------------------------------
email=0 # 1 or greater to enable email
show=1 # 1 to show osd
echo -n "" > /tmp/tts # Nice to know when things happen
ALERT_PERCENTAGE=75 # 90% disk used, ~500mb remaining on stock install?
HOSTNAME=`hostname`
RREMAINING=`df / |awk '{print $5}' |tail -1 |sed s/%//` # root status
MREMAINING=`df /myth |awk '{print $5}' |tail -1 |sed s/%//` # myth status
# root
echo " Root Partition has used ${RREMAINING}% of space." >>/tmp/tts
if [ $ALERT_PERCENTAGE -lt $RREMAINING ]; then
date > /tmp/tts
echo "WARNING, $HOSTNAME has ${RREMAINING}% root disk space used." >>/tmp/tts
# bump flag
email="$(($email + 1 ))"
show="$(($show + 1 ))"
fi
ALERT_PERCENTAGE=85 # 85% myth partition used
REMAINING=`df /myth |awk '{print $5}' |tail -1 |sed s/%//`
# myth
echo " Myth Partition has used ${MREMAINING}% of space." >>/tmp/tts
if [ $ALERT_PERCENTAGE -lt $MREMAINING ]; then
date > /tmp/tts
echo "WARNING, $HOSTNAME has ${MREMAINING}% disk space used for media." >>/tmp/tts
# bump flag
#email="$(($email + 1 ))"
#show="$(($show + 1 ))"
fi
# show it from here if flagged
if [ $show -gt "1" ]; then
cat /tmp/tts | osd_cat --l=8 --delay=6 --font=$FONT --shadow=3 --color=$ fontcolor --pos=bottom --align=centre &
fi
# email it from here if flagged
if [ $email -gt "1" ]; then
# Email me when root disk usage exceeds a specified percentage.
date > /tmp/tts
SENDER=mythtv@my.house
RECIPIENT=emailme@my.work
SMTP_SERVER=mail.my.isp
df -h | sendEmail -f $SENDER -t $RECIPIENT -s $SMTP_SERVER -u "$HOSTNAME has ${RREMAINING}% root disk space used."
email=0
fi
#done
Finally, I beat up on Cecil's original /usr/local/bin/ver.sh script to make it useful to me.
Code:
#!/bin/bash
killall osd_cat
lsmod |grep "ivtvfb "|cut -b1-6 >/tmp/tv
if [ "$(cat /tmp/tv)" = "ivtvfb" ]; then
fontsize="25"
fontcolor="lightyellow"
else
fontsize="34"
fontcolor="yellow"
fi
export FONT="-adobe-helvetica-bold-*-*-*-$fontsize-*-*-*-*-*-*-*"
export DISPLAY=:0
cat /etc/KnoppMyth-version > /tmp/ver
date >> /tmp/ver
echo "....." >> /tmp/ver
/sbin/ifconfig |grep eth |cut -b1-4 >/tmp/net
/sbin/ifconfig "$(cat /tmp/net)" | sed -n -e '/inet addr:\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*/s//\1/p' | cut -c11-26 >/tmp/ip
echo -n "IP $(cat /tmp/ip) _._ MythTV - " >> /tmp/ver
cat /etc/hostname >> /tmp/ver
echo "....." >> /tmp/ver
cat /etc/mythtv/version >> /tmp/ver
echo "....." >> /tmp/ver
/usr/bin/run-space-check.sh
cat /tmp/tts >> /tmp/ver
cat /home/mythtv/lbu.txt >> /tmp/ver
cat /tmp/ver | osd_cat --l=14 --delay=18 --font=$FONT --shadow=2 --color=$fontcolor --pos=middle --align=centre&
Now when I press alt v or select version on the menu, I get some meat & potatoes. Those with a 350 card will see if the ivtvfb is loaded as the font changes color and size to work with a tv out display.
One cavet, ip will be blank if you have two nics, you will have to manually select one or the other. ( l left room for improvments Smile ) Caution if doing copy and paste, watch for line wrapped lines!
Many thanks to tjc & Human who made it possible for me to offer this.small token Smile
Mike