sfs-duplication-glitches/do-plication

48 lines
1.2 KiB
Plaintext
Raw Normal View History

2021-01-05 23:41:51 +01:00
#!/bin/bash
2021-01-06 00:37:09 +01:00
if [ "$1" = "-h" ]
2021-01-05 23:41:51 +01:00
then
echo "do-plication <option> [directory to back up]"
echo
echo "Options:"
echo
echo "-a append arcive to the back of the tape"
echo "-c checks (lists) the contents of the n'th arcive {do-plication <option> <n>"
echo "-f Override the n'th arcive {do-plication <option> <n> [directory to back up]}"
echo "-l Load the n'th arcive {do-plication <option> <n> [directory to back up]}"
echo
exit 0
2021-01-06 00:35:07 +01:00
fi
2021-01-05 23:41:51 +01:00
# Going to the right directory
# cd /media
case "$1" in
# overwrite the tape from the begining
-a)
2021-01-06 00:35:07 +01:00
sudo mt -f /dev/nst0 eod;
2021-01-06 00:10:56 +01:00
sudo mt -f /dev/nst0 status;
2021-01-06 00:35:07 +01:00
echo "your arcive will be the file number"
2021-01-05 23:41:51 +01:00
sudo screen -dmS do-plication tar -cvf /dev/nst0 "$2"
true
;;
-c)
sudo mt -f /dev/nst0 asf "$2";
sudo tar tvf /dev/st0
true
;;
-f)
2021-01-06 00:35:07 +01:00
sudo mt -f /dev/nst0 asf "$2";
2021-01-06 00:10:56 +01:00
echo "your arcive wil be $2";
2021-01-05 23:41:51 +01:00
sudo screen -dmS do-plication tar -cvf /dev/nst0 "$3"
true
;;
-l)
2021-01-06 00:35:07 +01:00
sudo mt -f /dev/nst0 asf "$2";
2021-01-05 23:41:51 +01:00
sudo screen -dmS do-plication tar xvf /dev/nst0 -C "$3"
true
esac
exit $?