You are missing a period in .local
You are missing a period in .local
The problem is you have such an outdated system that the tar version on your system can't deal with filenames with spaces in it and doesn't listen to excludes. When I try it on my Fedora 35 system using tar it works with filenames with spaces in it and it works when using --exclude= to exclude a file. So the script also works on my system so the problem is with your system. I spend all day with you on this, you should reinstall your Fedora 14 system with Fedora 35 because Fedora 14 is an End of Life OS and doesn't receive anymore security updates so it shouldn't even be connected to the internet. So why are you running such an outdated system?I don't get it
The problem is you have such an outdated system that the tar version on your system can't deal with filenames with spaces in it and doesn't listen to excludes. When I try it on my Fedora 35 system using tar it works with filenames with spaces in it and it works when using --exclude= to exclude a file. So the script also works on my system so the problem is with your system. I spend all day with you on this, you should reinstall your Fedora 14 system with Fedora 35 because Fedora 14 is an End of Life OS and doesn't receive anymore security updates so it shouldn't even be connected to the internet. So why are you running such an outdated system?
End of Life Releases
Learn more about Fedora Linux, the Fedora Project & the Fedora Community.fedoraproject.org
I think it's insane that your teaching is making you work with such an outdated version! Are you running a virtual machine or how are you running it?
You can download an iso of the latest Fedora release here, then you can use the iso to install a new vm and then you can create the users you have on your other system as well. At some point during or after the installation process it will ask you to make a user, once you are then logged into the newly installed system you can then create a new user by doing this in the terminal:
1. Create user: useradd username
2. Change user password: passwd username
[tux@fedora bin]$ cat /etc/fedora-release
Fedora release 35 (Thirty Five)
[tux@fedora bin]$ cat backup.sh
#!/bin/bash
datapath="/home"
backuppath="/var/backup"
filename="$backuppath/$(date +%u-%a-%Y%m%d)-fullbackup.tar.gz"
if [ ! -d "$backuppath" ] ; then
mkdir "$backuppath"
fi
echo "Creating tar of location $datapath to $backuppath"
find $datapath | grep -v gvfs.* | xargs tar -cpzf $filename
if [ $? -eq 0 ]
then
echo "Backup Finish"
else
echo "Backup Failed"
fi
[tux@fedora bin]$ sudo ./backup.sh
Creating tar of location /home to /var/backup
tar: Removing leading `/' from member names
tar: Removing leading `/' from hard link targets
Backup Finish
[tux@fedora bin]$ ls -l /var/backup/
total 28
-rw-r--r--. 1 root root 25176 Nov 3 18:38 3-Wed-20211103-fullbackup.tar.gz
Glad to have helped out even though it only lead to frustration, I should have asked you from the start but didn't think you were running on such an outdated version. If you need any help during or after installation be sure to create a new topic on the forums, I do not understand why a teacher would make you use such an outdated version because it's not a smart idea to run an end of life of os and it has outdated tools. That version of Fedora has been end of life for 10 years!! Here let me show you that the script actually works on my Fedora 35 vm.
Code:[tux@fedora bin]$ cat /etc/fedora-release Fedora release 35 (Thirty Five) [tux@fedora bin]$ cat backup.sh #!/bin/bash datapath="/home" backuppath="/var/backup" filename="$backuppath/$(date +%u-%a-%Y%m%d)-fullbackup.tar.gz" if [ ! -d "$backuppath" ] ; then mkdir "$backuppath" fi echo "Creating tar of location $datapath to $backuppath" find $datapath | grep -v gvfs.* | xargs tar -cpzf $filename if [ $? -eq 0 ] then echo "Backup Finish" else echo "Backup Failed" fi [tux@fedora bin]$ sudo ./backup.sh Creating tar of location /home to /var/backup tar: Removing leading `/' from member names tar: Removing leading `/' from hard link targets Backup Finish [tux@fedora bin]$ ls -l /var/backup/ total 28 -rw-r--r--. 1 root root 25176 Nov 3 18:38 3-Wed-20211103-fullbackup.tar.gz
[tux@fedora bin]$ cat /etc/fedora-release
Fedora release 35 (Thirty Five)
[tux@fedora bin]$ cat backup.sh
#!/bin/bash
datapath="/home"
backuppath="/var/backup"
filename="$backuppath/$(date +%u-%a-%Y%m%d)-fullbackup.tar.gz"
if [ ! -d "$backuppath" ] ; then
mkdir "$backuppath"
fi
echo "Creating tar of location $datapath to $backuppath"
tar -cpzf $filename $datapath
if [ $? -eq 0 ]
then
echo "Backup Finish"
else
echo "Backup Failed"
fi
[tux@fedora bin]$ sudo ./backup.sh
Creating tar of location /home to /var/backup
tar: Removing leading `/' from member names
Backup Finish
[tux@fedora bin]$ tar xzf /var/backup/3-Wed-20211103-fullbackup.tar.gz
[tux@fedora bin]$ ls -l /var/backup
total 20
-rw-r--r--. 1 root root 19803 Nov 3 18:50 3-Wed-20211103-fullbackup.tar.gz
[tux@fedora bin]$ ls
backup.sh home
[tux@fedora bin]$ cat home/tux/Desktop/new\ file.txt
Hello World
OP was using Fedora 14(which has been end of life for 10 years!!) given to them by their teacher, the script worked on my Fedora 35 not on Fedora 14. It seems the tar version of Fedora 14 can't deal with spaces in filenames and doesn't work excluding files using --exclude= while both of those works on my Fedora 35 vm. Gvfs was in use by several users so only way to go around to prevent tar from failing was by excluding that. I should have asked in the beginning what version they were running I was assuming a more recent version I assumed wrong again. I advised them to install a Fedora 35 vm and then run the script there since that same script was already working for me 5 pages ago.Blimey, this thread escalated quickly!
Just finished work and saw the notifications, ha ha!
I pasted the wrong script, here is the script that @JasKinasis helped you out with. So you can see that it works as well.
Code:[tux@fedora bin]$ cat /etc/fedora-release Fedora release 35 (Thirty Five) [tux@fedora bin]$ cat backup.sh #!/bin/bash datapath="/home" backuppath="/var/backup" filename="$backuppath/$(date +%u-%a-%Y%m%d)-fullbackup.tar.gz" if [ ! -d "$backuppath" ] ; then mkdir "$backuppath" fi echo "Creating tar of location $datapath to $backuppath" tar -cpzf $filename $datapath if [ $? -eq 0 ] then echo "Backup Finish" else echo "Backup Failed" fi [tux@fedora bin]$ sudo ./backup.sh Creating tar of location /home to /var/backup tar: Removing leading `/' from member names Backup Finish [tux@fedora bin]$ tar xzf /var/backup/3-Wed-20211103-fullbackup.tar.gz [tux@fedora bin]$ ls -l /var/backup total 20 -rw-r--r--. 1 root root 19803 Nov 3 18:50 3-Wed-20211103-fullbackup.tar.gz [tux@fedora bin]$ ls backup.sh home [tux@fedora bin]$ cat home/tux/Desktop/new\ file.txt Hello World
#!/bin/bash
datapath="/home"
backuppath="/var/backup"
filename="$backuppath/$(date +%u-%a-%Y%m%d)-fullbackup.tar.gz"
if [ ! -d "$backuppath" ] ; then
mkdir "$backuppath"
fi
echo "Creating tar of location $datapath to $backuppath"
tar -cpzf $filename $datapath
if [ $? -eq 0 ]
then
echo "Backup Finished"
else
echo "Backup Failed"
fi