#! /bin/csh -f # # Figger out which'o dem dern tapes to dump onto, and do it. # # usage: # # dailydump [-] [month date] # Performs a daily dump. Specify the month and date to do a dump for # another day. The month should be a three letter abbreviation. # The - option makes dailydump just print information about the dump # instead of actually doing it. # # -don 10/26/84 made it # -don 11/28/84 made it a lot smarter # -don 11/30/84 made it wise # set l = ($* kludge) if ("$l[1]" == "-") then set doit = 0 set l = ($l[2-]) else set doit = 1 endif if ($#l == 3) then set d = ($l[1-2]) else set d = `date` set d = ($d[2-3] $d[1]) endif echo Yow\! Have we done the daily dump for $d[1-2] yet\? set t = `grep -i "$d[1-2] " /etc/tape.sched` echo $t if ("$t" == "") then echo Bad news, spazmoid\! The file /etc/tape.sched doesn\'t have an entry for the date \""$d[1-2]."\" Either you goofed, or you gotta go update the file. | fmt exit 1 else if ("$t[4]" != "-") then echo Yes we have, Bozo\! It was a level $t[7] dump on tape $t[5]. exit 0 else if ($doit == 0) then echo No we haven\'t\! It should be a level $t[7] dump on tape $t[5]. exit 0 else if ("$t[5]" == "0") then echo You don\'t expect me to do the biweekly dump all by myself, do you\? It\'s got to be done by hand, silly\! Use tapes $t[5]. | fmt exit 1 else echo Be a nice human and mount tape $t[5], will you\? And after you\'re done, why don\'t you type a return\? | fmt set line = $< if ("$line" != "") then echo "\`\`"$line"\'\'\?\!\? Think you\'re cute, ehe\? endif echo Very good. You can go do something else for a little bit, while I do the dump, but don\'t leave, because I\'ll have some more stuff for you to do pretty soon. I\'m going to do a level $t[7] dump on tape $t[5] now, so don\'t bother me for a bit, okay\? | fmt dodump $t[7] $t[5] cp /etc/tape.sched /tmp/tape.sched.$$ sed "s/ $t[1] $t[2] $t[3]/ + $t[1] $t[2] $t[3]/g" /etc/tape.sched rm /tmp/tape.sched.$$ echo I\'m all done now, so you should unmount the tape and put it back. Don\'t forget that, now. That\'s a good human. | fmt exit 1 endif