Hello Ubuntu forums!
I am new to Ubuntu, and so far have done several things I am quite proud of:
- Made an apache webserver with my own html (before a week ago I had never touched it)
- Made a stratum mining server +titcoin node
And my latest project is making a shell script to backup my ENTIRE (that’s right) hard drive to a huge external one. Getting to the point, I know there’s quite a bit I could improve on, and I would like your opinion on it:
Code:
#!/bin/bash
read -n1 -p “Would you like to back up your system? Uno for Si, and Dos for No.” input
echo
case $input in
1) fdisk -l;
echo;
read -p “Please enter the name of your backup disk that was displayed in the fdisk window: ” disk ;
echo;
echo “Backups now in progress! Please be aware that backups are saved to a Backups directory which this script creates, and backups are tarred and labelled by date!”;
echo “THIS WILL TAKE A VERY VERY LONG TIME IF YOU HAVE A LARGE FILESYSTEM! PLEASE BE PATIENT!!!”;
cd /;
sudo mkdir -p /mnt/$disk && sudo mount /dev/$disk /mnt/$disk && sudo mkdir -p /mnt/$disk/Backups && sudo tar -cp $(date +%Y%m%d).tar --directory=/ --exclude=proc --exclude=sys --exclude=dev/pts --exclude=backups . && sudo cp $(date +%Y%m%d-%H).tar /mnt/$disk/Backups;
echo “Okay, all done! To restore your system, you will have to untar and manually do it yourself. If you have any issues, email harmius@icloud.com!”;;
2) echo “Then why are you running this script?”;;
*) echo “I'm sorry, but I can’t do that…”
esac
Honestly, I have no idea what I am doing. Any suggestions?
Bookmarks