shimell@stc.UUCP (Dave Shimell) (05/03/85)
<gobble gobble> I enclose a dump script which we run every night via crontab. The script runs on BSD4.2 and does an incremental dump level 6 Mon-Thu and a level 3 on Fri. Once a month we do a manual level 0. Yes, I know this is a trivial command script to write but how many of you still labour with manual dumps? Operation is simple. a) load tape before going home, b) remove tape in morning! All file systems are dumped to a single tape therefore you have to "mt fsf n" to the correct file system before restore. Bugs: - If the dumps require more than a single tape, the last dump must be aborted and manually restarted. (I guess the script could keep track of the amount of tape used in previous dump run.) As the script is reading /dev/console, you have to compete with getty to talk to dump. - There is a check for machine stc-b (6250 bpi), you may have to change this line if you use a 6250 bpi tape drive. Any one know of a better way of finding out the tape density? - The hostname call fails when single user. -=-=-=-=-=-=-=-=- crontab entry -=-=-=-=-=-=-=-=- 0 22 * * 1-5 /etc/autodump < /dev/console > /dev/console 2>&1 -=-=-=-=-=-=-=-=- Autodump follows -=-=-=-=-=-=-=- #!/bin/sh # 'Dump script for single tape dump by crontab' if test "$1" != ""; then weekday="manual" level="$1" else set `date` case "$1" in Mon) # This backup will probably be done manually weekday=Monday level=6 ;; Tue) # First of the week weekday=Tuesday level=6 ;; Wed) # Second stab weekday=Wednesday level=6 ;; Thu) # Should still be lots of space weekday=Thursday level=6 ;; Fri) # Final unattended weekday=Friday level=3 ;; *) # Any other day assume an intermediate backup weekday=Weekend level=6 ;; esac fi echo "autodump: ${weekday} level = ${level}" > /dev/console echo "autodump: dump W" > /dev/console /etc/dump W > /dev/console 2>&1 if test `hostname` = stc-b; then args="${level}udf 6250 /dev/rmt12" else args="${level}uf /dev/rmt12" fi set `awk -F: '$3 ~ /^rw$|^rq$/ {if ($2 != "/tmp") print $1, $2}' /etc/fstab` while test $1 do echo "autodump: dump $args $1 ($weekday dump of $2)" > /dev/console sync sync sync /etc/dump $args $1 > /dev/console 2>&1 shift shift done mt rew mt offl echo "autodump: backups completed" > /dev/console -- Regards, Dave Shimell. <shimell@stc.UUCP> {root44, ukc, idec, stl, creed}!stc!shimell