#!/bin/bash # $Header: /CVSROOT/public/scylla-charybdis/md5backup/bin/sc-loop.sh,v 1.2 2004/09/29 23:32:44 tino Exp $ # # Loop over the backup script. # Output and Input come from a terminal. # # The terminal is best a screen or ptybuffer. # This way the backup can be commanded a little bit. # # The mysql root password must be stored with the "setpw" # command on the first run. It's not stored securely! # # $Log: sc-loop.sh,v $ # Revision 1.2 2004/09/29 23:32:44 tino # many minor and mini fixes, sc-loop.sh should work again # # Revision 1.1 2004/09/28 21:01:39 tino # added cd /backup/charybdis || exit 1 umask 022 TIMEOUT="${1:-30000}" # wait time arround 8:20 between backups PWFILE="$2" [ -z "$PWFILE" ] && PWFILE="`basename "$0" .sh`.pw" HIDEPW="${3:-scramble}" status() { echo "----------------------------------------------------------------" ls -al md5move/*/. echo "----------------------------------------------------------------" cat tmp/log.md5move echo "----------------------------------------------------------------" df -k echo "----------------------------------------------------------------" tail -10 tmp/log date +'%Y-%m-%d %H:%M:%S' } setpw() { rm -f "$PWFILE" echo "$arg" | openssl enc -e -des -a -k "$HIDEPW" -out "$PWFILE" chmod 0400 "$PWFILE" echo "password changed" } while echo "================================================================" echo "== Backup loop: Waiting for timeout or command: help for help ==" echo "================================================================" do com="" read -rt 30000 com arg case "$com" in '') ;; help) cat <