3 # List and fetch backups.
5 CONNSTR
="9248@usw-s009.rsync.net"
6 RESTORE_LOC
=/vicepa
/hcoop-backups
/restored
9 if test -n "$3" ||
test -z "$2"; then
10 echo "Error: Invalid number of arguments for 'get' command."
16 scp
"$CONNSTR:$date/$file" "$RESTORE_LOC/$date-$file"
19 if test $stat -eq 0; then
20 echo "Get succeeded. You may now run:"
21 echo " backup-manager restore $date '$file' VOLUME-NAME"
22 echo "to restore the file into an AFS volume."
24 echo "Error: Get failed with status $stat."
31 echo "Error: Invalid number of arguments for 'list' command."
35 local OUT
=$
(ssh $CONNSTR ls -l -h $@
)
37 if test $
(<<< "$OUT" wc -l) -ge $
(tput lines
); then
38 # if output takes up all the lines on the screen, use a pager
39 if test -n "$PAGER"; then
51 if test -n "$4" ||
test -z "$3"; then
52 echo "Error: Invalid number of arguments for 'get' command."
59 file="$RESTORE_LOC/$date-$file"
60 if test ! -f "$file"; then
61 echo "Error: File '$file' does not exist."
64 vos examine
"$volname" >/dev
/null
2>&1
66 if test $stat -eq 0; then
67 echo "Error: Volume '$volname' already exists."
70 < "$file" ccrypt
-cdk /etc
/backup-encryption-key \
71 | gunzip | vos restore deleuze
/vicepa
"$volname"
74 if test $stat -eq 0; then
75 echo "Restore succeeded. You may now run:"
76 echo " fs mkm '/afs/hcoop.net/.old/$volname' '$volname'"
77 echo "to mount the restored AFS volume."
79 echo "Error: Restore failed with status $stat."
86 echo "Error: Invalid number of arguments for 'quota' command."
94 echo "Usage: backup-manager [get|list|quota] [args...]"
96 echo " get DATE FILE Fetch a file into $RESTORE_LOC"
97 echo " help Display this message"
98 echo " list [DATE] List dates available, or files with given date"
99 echo " quota Display info about the quota"
100 echo " restore DATE FILE VOLUME-NAME"
101 echo " Take a fetched file (referenced by DATE and" \
103 echo " it into a new AFS volume with the name" \
109 if test -z "$1"; then
110 echo "Error: Incorrect number of arguments."
122 restore
) restore $@
;;
124 echo "Error: Invalid command."