diff options
author | Britney Fransen <brfransen@gmail.com> | 2010-06-09 21:01:12 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2010-06-09 21:01:12 (GMT) |
commit | 1dbb59aab559f250818ea15c834fbd2228849dce (patch) | |
tree | d33785188f53a48010b36635a870106020ced8a5 /abs/core-testing/LinHES-system/bin/mythbackup | |
parent | 8690fb6d1fe3e2ee832a2b21a8085290ef3721e0 (diff) | |
download | linhes_pkgbuild-1dbb59aab559f250818ea15c834fbd2228849dce.zip linhes_pkgbuild-1dbb59aab559f250818ea15c834fbd2228849dce.tar.gz linhes_pkgbuild-1dbb59aab559f250818ea15c834fbd2228849dce.tar.bz2 |
LinHES-system: Update mythbackup and mythrestore to show OSD status during backup and restore. Adds description to the menu item showing the last backup and restore. Only displays in themes that show description line in menu items. Closes #173
Diffstat (limited to 'abs/core-testing/LinHES-system/bin/mythbackup')
-rwxr-xr-x | abs/core-testing/LinHES-system/bin/mythbackup | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/abs/core-testing/LinHES-system/bin/mythbackup b/abs/core-testing/LinHES-system/bin/mythbackup index d0d028d..cf4d491 100755 --- a/abs/core-testing/LinHES-system/bin/mythbackup +++ b/abs/core-testing/LinHES-system/bin/mythbackup @@ -7,6 +7,21 @@ } #---------------------------------------------------------------------------- +# Function to display status onscreen +osd() +# Arg_1 = display text Arg_2 = delay time Arg_3 = line num +{ + TEXT=$1 + killall -9 osd_cat + if [ $3 -gt 1 ]; then + for ((i=2; i <= $3 ; i++)) + do + TEXT="\n"$TEXT + done + fi + printf "$TEXT" | osd_cat --lines=6 --pos=middle --align=center --delay=$2 --color white -O 2 -u black -f -adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-* & +} + # Prevent mythshutdown from shutting down the system in the middle... lock_myth @@ -14,12 +29,15 @@ lock_myth play_sound init.wav # Keep a chain of recent backups, +export DISPLAY=:0.0 +osd "Rolling over old backups..." 0 1 echo "Starting rollover of old backups, this may take a while..." [ -f "$BACKUP_SQL" ] && shrink $BACKUP_SQL [ -f "$BACKUP_TAR" ] && shrink $BACKUP_TAR backup_roller .19 .18 .17 .16 .15 .14 .13 .12 .11 .10 .9 .8 .7 .6 .5 .4 .3 .2 .1 '' echo "Rollover completed." +osd "Checking the database..." 0 2 # Start with the database backup, first we make sure it's healthy, and # then we can dump it. # Doing this while the backend is active would be BAD. @@ -31,10 +49,12 @@ cd $DATABASE_DIR $MYISAMCHK -f *.MYI start_mysqld +osd "Backing up database..." 0 3 # Dumps the $DATABASE database $MYSQLDUMP -v -c -u root $DATABASE > $BACKUP_SQL shrink $BACKUP_SQL +osd "Backing up files..." 0 4 # Now to backup the other files, no fooling around, grab everything in the # list because you never know what you'll want, and we can always get clever # about what to restore later... @@ -49,19 +69,32 @@ shrink $BACKUP_TAR $CHOWN root:root $BACKUP_TAR* $BACKUP_SQL* $CHMOD go-rwx $BACKUP_TAR* $BACKUP_SQL* +osd "Testing backup..." 0 5 echo "Sanity checking your backup..." play_sound testing.wav # Play a sound to let you know the outcome. if check_files_and_tables $BACKUP_LIST ; then + osd "Backup completed successfully." 5 6 echo "Backup passes all checks." + COMPLETE_MSG="Last backup completed on `date '+%D @ %-I:%M %p'`" play_sound complete.wav STATUS=0 else + osd "Backup FAILED." 5 6 echo "The backup is bad or already out of date!" + COMPLETE_MSG="Last backup FAILED on `date '+%D @ %-I:%M %p'`" play_sound fail.wav STATUS=1 fi +# Add Last backup status to menu item +if grep "<description>" /usr/share/mythtv/themes/defaultmenu/mythbackup.xml >/dev/null 2>&1 +then + sed -i "s_\<description\>.*\<description\>_description\>$COMPLETE_MSG\<\/description_" /usr/share/mythtv/themes/defaultmenu/mythbackup.xml +else + sed -i.orig " /NONE/ i\ \<description\>$COMPLETE_MSG\<\/description\>" /usr/share/mythtv/themes/defaultmenu/mythbackup.xml +fi + # Now we can restart the backend. start_mythbackend |