Understanding the syntax for invoking tar

Understanding the syntax for invoking tar

Post by Donald Douglas Joll » Fri, 25 Nov 1994 06:03:54



I am using the following line as part of a script which is called
by cron to handle system backup:

    tar -c -p -f /dev/rft0 -N 08/01/94 / >/dev/null 2>&1

I would expect that all files with date stamps after 08/01/94 would
be backed up and those would be the ONLY files that would be
backed up.  Not so.  Sometimes I only get a very few files
written to the archive; but, of the few that are written, several
have date stamps much earlier than 08/01/94.  Other times I get a
whole lot of files written to the archive (presumably an entire
system backup) INCLUDING many files with date stamps earlier than
08/01/94.

One of the things that I suspect may be a problem is the format
of the date used with the -N option to tar.  The man pages do not
specify how the date is to be formatted.

Additionally, the man pages for tar say:

     -B, --read-full-blocks

I got that.  Specifying -B invokes the option to read full blocks.
However, I also see things like:

     --checkpoint

Now how does one invoke the chekpoint option?

Thanks, for any help in clarifying the mysteries of understanding the
syntax of the tar command.

    ... doug  
______________________________________________________________________________
Doug Jolley           |    Don't bogart that file, my friend.    | PGP key

------------------------------------------------------------------------------

 
 
 

Understanding the syntax for invoking tar

Post by Ken Edwar » Fri, 25 Nov 1994 15:36:00



[ ...]
:     tar -c -p -f /dev/rft0 -N 08/01/94 / >/dev/null 2>&1

: I would expect that all files with date stamps after 08/01/94 would
: be backed up and those would be the ONLY files that would be
: backed up.  Not so.  Sometimes I only get a very few files
: written to the archive; but, of the few that are written, several
: have date stamps much earlier than 08/01/94.  Other times I get a
: whole lot of files written to the archive (presumably an entire
: system backup) INCLUDING many files with date stamps earlier than
: 08/01/94.

Remember that tar is using the inode change time, not the file modification
time. Try
ls -ltc
to see if the times match.

: One of the things that I suspect may be a problem is the format
: of the date used with the -N option to tar.  The man pages do not
: specify how the date is to be formatted.

Don't know about the eratic behaviour, but the date option is correct.
Actually a number of formats work
-N 08/01/94
-N "1 Aug 94"

try
date --date "1 Aug 94"
date --date "08/01/94"
to see if your format will work.

: Additionally, the man pages for tar say:

:      -B, --read-full-blocks

: I got that.  Specifying -B invokes the option to read full blocks.
: However, I also see things like:

:      --checkpoint

: Now how does one invoke the chekpoint option?

tar --checkpoint -t     -z       -B                 -f     filename
OR
tar --checkpoint --list --gunzip --read-full-blocks --file filename
--

 
 
 

1. wanted: terse string to force "syntax error/abort", to avoid mis-invoking..

From time to time I have mistakingly invoked logfiles
or other text file reports with sh or bash.  In most cases these
files are created by other system admin scripts so I would
like to prevent this by building these reports,
so that bash or sh is forced to abort early on.

It's not enough to make these files non-executable, or to
have a bogus interpreter specified as in "#!/bin/false".
"sh foo" foils both of the above.

  bash 2.03.8 $ echo -e '#!/bin/false\necho hi' >foo ;chmod 444 foo
  bash 2.03.8 $ ./foo;sh foo
  bash2: ./foo: Permission denied
  hi

I would like to place a string at the top of all these reports
that would cause bash or sh to abort right away. "exit 0" is not
bad, but it's somewhat ugly. "-()" seems to work, I'm hoping
there's something even cleaner..

  bash 2.03.8 $ echo -e '#!/bin/false\n-()\necho hi' >foo
  bash 2.03.8 $ sh foo
  foo: syntax error near unexpected token `echo'
  foo: foo: line 3: `echo hi'

Thanks for constructive comments .. pls refrain from calling me
stupid (agreed I was stupid/more like unconscious) for trying to
execute a logfile; the last time it happened was bouncing
between two scripts and confused myself into thinking
I was pasting the log file name into a "here document"
within thte script when in fact I was outside of any "here document"
delimiter, and the log file name ended up as first word on the line -
ouch!  

Oh well.. flame away, or yet another constructive approach.

--
thanks,
Tom Rodman
pls run for my address:  
  perl -e 'print unpack("u", "1\:6UP\,\$\!T\<F\]D\;6\%N\+F\-O\;0H\`");'

2. Netscape 3.0: Software Virtual Domains

3. Can't understand syntax.

4. When a pipe updated, any signal can be caught?

5. Complex Makefiles, what to read to understand enough the tar.ball installations

6. pppd dialing twice to connect?

7. Need help understanding 'tar'

8. Installing eth cards

9. help on tar command and its syntax.

10. Different syntax for 'tar' in linux and solaris.

11. tar syntax question

12. Help with tar syntax please

13. different syntax for "tar" in linux and solaris