summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/LinHES-system')
-rw-r--r--abs/core/LinHES-system/PKGBUILD21
-rwxr-xr-xabs/core/LinHES-system/diskspace2
-rwxr-xr-xabs/core/LinHES-system/diskspace.sh81
-rwxr-xr-xabs/core/LinHES-system/firstboot.sh21
-rw-r--r--abs/core/LinHES-system/myth_status.py14
5 files changed, 127 insertions, 12 deletions
diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index 1734865..f8baeaf 100644
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=LinHES-system
pkgver=2
-pkgrel=37
+pkgrel=41
arch=('i686')
MVDIR=$startdir/pkg/usr/LH
BINDIR=$startdir/pkg/usr/bin
@@ -11,7 +11,7 @@ backup=(etc/modprobe.d/alsa-base)
binfiles="LinHES-start optimize_mythdb.py
myth_mtc.py myth_mtc.sh LinHES-run
firstboot.sh load-modules-mythvantage.sh
- unclutter-toggle.sh tvterm.sh smolt.cron
+ unclutter-toggle.sh tvterm.sh
mythfrontend-start set_windowmanager.sh
myth_status.py myth_status.sh
xmsg.py install_supplemental_service.sh
@@ -19,9 +19,11 @@ binfiles="LinHES-start optimize_mythdb.py
lh_system_restore_job
lh_system_host_update
lh_system_all_host_update
- add_storage.py"
+ add_storage.py
+ diskspace.sh"
-source=(LinHES-session LinHES-profile.sh $binfiles alsa-base myth_mtc.lr)
+source=(LinHES-session LinHES-profile.sh $binfiles alsa-base myth_mtc.lr
+ diskspace smolt.cron)
build() {
cd $startdir/src
@@ -45,6 +47,7 @@ build() {
install -m644 -D $startdir/src/alsa-base $startdir/pkg/etc/modprobe.d/alsa-base.conf
install -m755 -D $startdir/src/smolt.cron $startdir/pkg/etc/cron.weekly/smolt.cron
+ install -m755 -D $startdir/src/diskspace $startdir/pkg/etc/cron.tenminutes/diskspace
mkdir $startdir/pkg/etc/logrotate.d
cp $startdir/myth_mtc.lr $startdir/pkg/etc/logrotate.d
}
@@ -55,14 +58,13 @@ md5sums=('d6a564f3286590875874573107940908'
'd1f27cb422010077c841376526fe46ea'
'2ef9f945e034119f77d9b6beb17e4fa5'
'5c96527397a35519d72c78d6e3c8dbea'
- '18a884a73344ff6eb74f63b49745e0f5'
+ '5e67a8b7ff57ec32d668bce7aab0aa6d'
'dc3eef2a624754e16805d72bbe488b67'
'dc0be354ce77ba2b89868fc29b942c43'
'542e670e78d117657f93141e9689f54d'
- 'abe887472a170bd1a8e6da6a7b7e93e4'
'752488eb8bfb672ce0e4c924f7faf3d1'
'ba351b92e69bcaf26a9bf80417b09c3c'
- '60219aab8a177c783d7a658d56683db4'
+ 'b41b08ea923d94b90d22f92e291ad9ee'
'962a3e9eaba2d1466251b7ab0956705d'
'd03aedeeeda0f5e9c1eb437411c88477'
'94ce8f1d5085c0db7b267db8c2e9a3ff'
@@ -71,5 +73,8 @@ md5sums=('d6a564f3286590875874573107940908'
'859a80ddb4c234506379c605114c1343'
'47e093e8cfe4b5b96602358e1f540832'
'6faeba0aeb38e772121f751cabda8683'
+ '68e3e87571f3b0fa4a48a10df50dc220'
'eb879fee9603a05d5420d4ce8ed9e450'
- 'f1870a9522c79e6b248fcbf81dec3280')
+ 'f1870a9522c79e6b248fcbf81dec3280'
+ '84492954db16740f949d795b74383189'
+ 'abe887472a170bd1a8e6da6a7b7e93e4')
diff --git a/abs/core/LinHES-system/diskspace b/abs/core/LinHES-system/diskspace
new file mode 100755
index 0000000..ab3c91b
--- /dev/null
+++ b/abs/core/LinHES-system/diskspace
@@ -0,0 +1,2 @@
+#!/bin/bash
+/usr/bin/nice -n19 /usr/LH/bin/diskspace.sh -osd
diff --git a/abs/core/LinHES-system/diskspace.sh b/abs/core/LinHES-system/diskspace.sh
new file mode 100755
index 0000000..2173c6e
--- /dev/null
+++ b/abs/core/LinHES-system/diskspace.sh
@@ -0,0 +1,81 @@
+#!/bin/sh
+### Monitor free disk space
+# Display alert if the free percentage of space is >= $ALERT
+
+#
+# Static Config Variables
+#
+ALERT=90 # free space percentage to trigger an alert
+
+#
+# Static Binary Paths
+#
+DF='/bin/df'
+GREP='/bin/grep'
+AWK='/bin/awk'
+CUT='/bin/cut'
+HOSTNAME='/bin/hostname'
+DATE='/bin/date'
+OSD_CAT='/usr/bin/osd_cat'
+export DISPLAY=:0.0
+#
+# Static System Variables
+#
+THIS_HOST=`${HOSTNAME}`
+
+#
+# Check CLI Options
+#
+VERBOSE=false
+OSD=false
+for ARG in "$@" ; do
+ case $ARG in
+ "-v")
+ VERBOSE=true
+ ;;
+ "-osd")
+ OSD=true
+ ;;
+ esac
+done
+
+#----------------------------------------------------------------------------
+. /etc/osd_cat.cfg || {
+ color=yellow
+ outline=2
+ outlinecolour=black
+ shadow=0
+ shadowcolour=black
+ font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*"
+}
+#----------------------------------------------------------------------------
+
+[ $VERBOSE = true ] && echo "Checking free disk space on ${THIS_HOST}"
+[ $VERBOSE = true ] && echo "Threshold for warning is ${ALERT}%"
+[ $VERBOSE = true ] && echo "------------------------------------------------------------------"
+
+# Dynamic Variables
+#DATE_STR=`${DATE} "+%d-%B-%y @ %H%Mhrs"`
+
+# Call df to find the used percentages. Grep for only local disks (not remote mounts like nfs or smb)
+# Pipe the output to awk to get the needed columns, then start a while loop to process each line.
+$DF -HPl | $GREP -E "^/dev/" | $AWK '{ print $5 " " $6 " " $1 }' | while read OUTPUT ; do
+ USED_PCENT=$(echo ${OUTPUT} | $AWK '{ print $1}' | $CUT -d'%' -f1 ) # Used space as a percentage
+ PARTITION=$(echo ${OUTPUT} | $AWK '{ print $2 }' ) # Mount Point (eg, /home)
+ DEVICE=$(echo ${OUTPUT} | $AWK '{ print $3 }' ) # Device (eg, /dev/sda1 or LABEL or UUID)
+ if [ $VERBOSE = true ] ; then
+ echo -e "Checking device ${DEVICE} which is mounted to ${PARTITION} \t${USED_PCENT}% used"
+ fi
+ if [ ${USED_PCENT} -ge $ALERT ]; then
+ if [ $VERBOSE = true ] ; then
+ echo "WARNING: ${PARTITION} (${DEVICE}) is ${USED_PCENT}% full on ${THIS_HOST}."
+ else
+ echo "WARNING: ${PARTITION} (${DEVICE}) is ${USED_PCENT}% full on ${THIS_HOST}." #|
+ if [ $OSD = true ] && [ ${PARTITION} = / ]; then
+ echo "WARNING: The root (${PARTITION}) partition is ${USED_PCENT}% full on ${THIS_HOST}." | $OSD_CAT --pos=top --offset=40 --align=center --delay=10 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+ fi
+ fi
+ fi
+done
+
+exit 0
diff --git a/abs/core/LinHES-system/firstboot.sh b/abs/core/LinHES-system/firstboot.sh
index 7e2f603..8e3dc57 100755
--- a/abs/core/LinHES-system/firstboot.sh
+++ b/abs/core/LinHES-system/firstboot.sh
@@ -23,6 +23,26 @@ function try_smolt {
}
+function fix_lirc_socket {
+ . /etc/systemconfig
+
+ # Fix LircSocket in mythtv database
+ SOCKET=`mysql -u mythtv -pmythtv -B --skip-column-names -h "${dbhost}" -D mythconverg -e \
+ "SELECT data FROM settings WHERE value = 'LircSocket' AND hostname = '${hostname}';"`
+ if [ "${SOCKET}" != "/var/run/lirc/lircd" ]; then
+ mysql -u mythtv -pmythtv -B --skip-column-names -h "${dbhost}" -D mythconverg -e \
+ "UPDATE settings SET data = '/var/run/lirc/lircd' WHERE value = 'LircSocket' AND hostname = '${hostname}';"
+ else
+ echo ">>>"
+ echo ">>> ATTENTION! ATTENTION! ATTENTION!"
+ echo ">>> Unable to connect the the MySQL database to make needed"
+ echo ">>> changes to the LIRC socket."
+ echo ">>> LIRC now uses /var/run/lirc/lircd and /dev/lirc is now"
+ echo ">>> obsolete. Update your MythTV settings to reflect this."
+ echo ">>>"
+ fi
+}
+
if [ ! -e /tmp/debug ]
then
@@ -35,6 +55,7 @@ then
fb_status=4
while [ $fb_status != 0 ]
do
+ fix_lirc_socket
try_smolt
if [ $fb_status != 0 ]
then
diff --git a/abs/core/LinHES-system/myth_status.py b/abs/core/LinHES-system/myth_status.py
index 4e44fd5..53d64d9 100644
--- a/abs/core/LinHES-system/myth_status.py
+++ b/abs/core/LinHES-system/myth_status.py
@@ -1,6 +1,6 @@
#!/usr/bin/python2
from MythTV import MythBE,MythDB,MythLog
-import datetime,time,sys
+import datetime,time,sys,subprocess
try:
be=MythBE()
db = MythDB()
@@ -12,6 +12,7 @@ cursor = db.cursor()
now = datetime.datetime.now()
farout=99999999
next_start_diff=datetime.timedelta(farout)
+num_upcoming=12
def formatTD(td):
#print td
@@ -68,10 +69,15 @@ for i in a:
print ""
-print "Upcoming Recordings:"
+print "Upcoming Recordings (Next %s scheduled):" %(num_upcoming)
print "--------------------"
a=be.getUpcomingRecordings()
+r=0
for i in a:
+ r += 1
+ if r > num_upcoming:
+ break
+
title_chan="%s (%s)" %(i.title, i.channame)
print " %s - %s - %-50s " %(i.starttime,i.hostname, title_chan)
#start_time=time.strptime(str(i.starttime), "%Y-%m-%d %H:%M:%S")
@@ -101,5 +107,5 @@ else:
ur=formatTD(next_start_diff)
print "The next recording starts in:\n %s" %(ur)
print ""
-
-
+subprocess.call("/usr/LH/bin/diskspace.sh",shell=True)
+print ""