Write a script that automates tar so the person executing the script always uses the desired options (cvp) and backup destination

Oops I forgot a word.
Code:
cat /etc/fedora-release
 


And can you share the output of the following.
Code:
umount /home/tabish/.gvfs
ls -la /home/tabish | grep gvfs
 

Attachments

  • um.png
    um.png
    39 KB · Views: 155
Now try running this again and share the output.
Code:
tar -cpzf /var/backup/3-Wed-20211103-fullbackup.tar.gz /home
 
Can you also share the output of the following running it as root.
Code:
find /home | grep gvfs
 
Now try running this again and share the output.
Code:
tar -cpzf /var/backup/3-Wed-20211103-fullbackup.tar.gz /home

[root@localhost tabish]# tar -cpzf /var/backup/3-Wed-20211103-fullbackup.tar.gz /home
tar: Removing leading / from member names
[root@localhost tabish]#
 
Can you also share the output of the following running it as root.
Code:
find /home | grep gvfs

[root@localhost tabish]# find /home | grep gvfs
/home/linda/.gvfs
/home/tabish/.local/share/gvfs-metadata
/home/tabish/.local/share/gvfs-metadata/computer:
/home/tabish/.local/share/gvfs-metadata/home-eb232174.log
/home/tabish/.local/share/gvfs-metadata/computer:-a6940406.log /home/tabish/.local/share/gvfs-metadata/home
/home/tabish/.local/share/gvfs-metadata/root-fddd6ee6.log
/home/tabish/.local/share/gvfs-metadata/root
/home/tabish/--exclude=.gvfs
/home/tabish/.gvfs /home/lisa/.gvfs
 
Okay I know what the problem is now, you are running a very outdated version of Federo(14) so it doesn't suprise me that tar excludes don't seem to work as expected and that the environment variable to disable gvfsd didn't do as expected. You should seriously reinstall that system with the most recent version of Fedora(35). One question, why are you running on such an outdated version? For now this should make your script work to exclude the gvfs in case it shows again with the gvfs permission problem.
Bash:
#!/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
 
Last edited:
Okay I know what the problem is now, you are running a very outdated version of Federo(14) so it doesn't suprise me that tar excludes don't seem to work as expected and that the environment variable to disable gvfsd didn't do as expected. You should seriously reinstall that system with the most recent version of Fedora(35). One question, why are you running on such an outdated version? For now this should make your script work to exclude the gvfs in case it shows again with the gvfs permission problem.
Bash:
#!/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

Same error
 

Attachments

  • err.png
    err.png
    90.4 KB · Views: 138
Can you change it to this.
Code:
#!/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
 
Can you change it to this.
Code:
#!/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

I cant see any changes here
 
I cant see any changes here
I edited my last post which you didn't see because it was such a small change.
Change this:
Code:
find $datapath | grep -v gvfs.* | xargs tar -cvpzf $filename
To this.
Code:
find $datapath | grep -v gvfs.* | xargs tar -cpzf $filename
Then run the script again and share the output.
 
Can you change it to this.
Code:
#!/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
 

Attachments

  • es.png
    es.png
    78.4 KB · Views: 140
I edited my last post which you didn't see because it was such a small change.
Change this:
Code:
find $datapath | grep -v gvfs.* | xargs tar -cvpzf $filename
To this.
Code:
find $datapath | grep -v gvfs.* | xargs tar -cpzf $filename
Then run the script again and share the output.
 

Attachments

  • es.png
    es.png
    78.4 KB · Views: 147
Share the output of the following.
ls -l /home/tabish/local/share/Trash/info /home/tabish/local/share/Trash/files /home/tabish/Desktop
 
Last edited:
I made a type in the last reply I made, can you run it again but like this.
ls -l /home/tabish/.local/share/Trash/info /home/tabish/.local/share/Trash/files /home/tabish/Desktop
 
You are missing a period in .local
ls -l /home/tabish/.local/share/Trash/info /home/tabish/.local/share/Trash/files /home/tabish/Desktop
 

Staff online

Members online


Top