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

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


Ken Heard wrote:
> Whenever I run this script -- or several others like it
> [...]
> tar -czf /media/fde/backups/kbrowsers.tgz  --exclude-caches \
> - --wildcards -T docs/tarlists/kbrowsers.lst
> [...]
> it returns the following:
> [...]
> 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
> [...]
> 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.

The only plausible theories i read so far are:
A: The script you run is not the script from which you take the tar
   command line.
B: tar gets somehow convinced that /media/fde/backups/kbrowsers.tgz
   is actually meant as /media/ssda/backups/kbrowsers.tgz.

(This is independent of the flaws of the script, which where pointed out.)

So i would try to exclude cause A by adding message output to the script,
and cause B by looking at the components of the .tgz path.
I.e. i would insert

  echo "Yes. This is indeed the script."
  ls -ld /media
  ls -ld /media/fde
  ls -ld /media/fde/backups
  ls -ld /media/fde/backups/kbrowsers.tgz


  tar -czf /media/fde/backups/kbrowsers.tgz   --exclude-caches \

Then i'd run the script and be curious what happens.

Have a nice day :)


Reply to: