You are not logged in.
Hello,
I am writing a backup script to backup my whole / directory, however I am running into what seems to me to be unexplainable problems:
backup.sh:
#!/bin/bash
#rsync back up script
while [ 1 ]; do #loop until rsync runs
if ! grep -q backup /proc/mounts; then #checks if the backup partition is mounted
espeak "The backup partition is not mounted. Please mount it as the script will try to run in one minute."
else
sudo bash -c #takes argument $1
"
rsync -auH --inplace --exclude-from=/home/maddog/backup.lst / $1 >> /var/log/backup.log;
pacman -Qqe > $1/prog.lst;
"
break
fi
sleep 1m
doneOutput of running "sh ./backup.sh /media/backup":
Password:
bash: -c: option requires an argument
./backup.sh: line 12:
rsync -auH --inplace --exclude-from=/home/maddog/backup.lst / >> /var/log/backup.log;
pacman -Qqe > /prog.lst;
: No such file or directoryHowever both files do indeed exist. If I remove the pacman line, I still get an error about /var/log/backup.log not existing. Note the sudo bash is requied as I am io-redirecting to files owned by root.
Another concern is if I run this script in cron how can I make sure that I don't shutdown the computer while the script is running?
Any help would be greatly appreciated.
Thanks,
airbus001
Offline
I fixed the problem the main problem was the placement of the first quotation mark, if anyone wants my script message me.
Offline