[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Script does not do what it is told to do



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2019-10-24 8:40 p.m., deloptes wrote:
> Ken Heard wrote:
> 
>> Whenever I run this script -- or several others like it
>> 
>> #!/bin/bash # Script to back up all browser files in directory
>> /home/ken/mozilla. STARTDIR=$PWD cd /home/ken tar -czf
>> /media/fde/backups/kbrowsers.tgz  --exclude-caches \ --wildcards
>> -T docs/tarlists/kbrowsers.lst cd "$STARTDIR"
>> 
>> it returns the following:
>> 
> 
> this is not possible because in the script you tell tar to create
> archive in /media/fde/backups/

Yes, that is the location where I want the archive kbrowsers.tgz to be
put.

>> ken@Turing:~$ tarkbrowsers tar (child):
>> /media/ssda/backups/kbrowsers.tgz: Cannot open: No such file or
>> directory tar (child): Error is not recoverable: exiting now tar:
>> /media/ssda/backups/kbrowsers.tgz: Cannot write: Broken pipe tar:
>> Child returned status 2 tar: Error is not recoverable: exiting
>> now
>> 
> 
> and here you are failing to write
> /media/ssda/backups/kbrowsers.tgz

/media/ssda/ .. does not exist, neither as a directory or in /etc/fstab

>> It is trying to save the tarball to a different portable storage 
>> device, ssda, which had failed and consequently is no longer in 
>> /etc/fstab.  How could such a thing happen?
>> 
> 
> obviously it is another script or whatever

But how?

>> However, if I pull the line with the tar command out of the
>> script and running it independently it does what it is told.  If
>> there is something wrong with the script I can't find it.
>> 
>> I also tried the script with the second line reading
>> STARTDIR="$PWD"; but that change made no difference, the result
>> was the same.
>> 
> 
> The question is where do you want to write the data - if on media
> attached then create entry in /etc/fstab so that you can mount it
> in consistent way, change the script and the problem will be gone.

/media/fde is the mount point for the device to which will be written
the archive.  It is properly mounted, and I can write files to it and
read those files.  As I said in my original post I am able to write
the archive successfully to /media/fde/backups/ by copying the tar
command line to a console and read the contents of the tarball.

> I have seen all kind of stupid and ugly admin scripts, where the
> author himself does not know how or why it is or it is not working
> at the end.
> 
> regards

Regards, Ken



-----BEGIN PGP SIGNATURE-----

iF0EARECAB0WIQR9YFyM2lJAhDprmoOU2UnM6QmZNwUCXbJjwQAKCRCU2UnM6QmZ
NzIJAJ9Ng8JazKDR52yEBcyEoatQBu7PQACcCT5xNctrkAiobqpPGG1Soj9lmCI=
=fv+M
-----END PGP SIGNATURE-----


Reply to: