Scripting Help: tar a dir with time and date as file tar file name..................TIA

Scripting Help: tar a dir with time and date as file tar file name..................TIA

Post by Boll Weevi » Mon, 16 Apr 2001 11:26:41



Scripting Help:  tar a dir with time and date as tar file name..................TIA

Hi,

I am trying to create a script that will tar a directory with the tar file name being the time and date of the execution of the script.... like:
        041520001624.tar
Any help would be much appreciated!!

 
 
 

Scripting Help: tar a dir with time and date as file tar file name..................TIA

Post by Logan Sh » Mon, 16 Apr 2001 14:31:56




Quote:>I am trying to create a script that will tar a directory with the tar file name being the time and date of the execution of the script.... like:
>    041520001624.tar
>Any help would be much appreciated!!

The "date" program can print the date in a user specified format.  For
example, "date '+%Y%m%d'" prints "20010415".  "man strftime" will
describe the format for you.

Once you have this, you can do something like this:

        tar cf `date +'%Y%m%d'`.tar mydirectory

but with your own format string instead of what I've chosen.

By the way, your "Subject:" line is fairly long.

  - Logan
--
my  your   his  her   our   their   _its_
I'm you're he's she's we're they're _it's_

 
 
 

1. Wanted: rcmd host tar x_?_vqf file.tar file1 ... fileN | tar xvf -

[X-posted to c.u.sco.misc & c.sys.sun.misc, no Followup-To set, I'll
check'em both]

Situation:

SCO v4.2 box as digital voice recorder, archiving VOX-files to Network
Jukebox Controller (basically HP MO Jukebox with 16 slots) running SunOS
4.1.3 sparc (sun4c). NJC is used for general backup/archive for whole
network. Size
of each archive tar-file is 300 MB, containing about 2500 VOX-files. So
far so good. But when it comes to user requesting old calls to be
replayed, he/she must wait a bit. At the moment, the restoring process
(say, of 100 VOX-files) is done with the following:

rcmd NJC cat archiveN.tar | tar xvqf - ${files_to_restore}

which is CPU time and network bandwidth wasting, if the files are not
stored at the beginning of archive ('tar ..q' - quits immediately when
all files are extracted). On average, the NJC must read 150 MB from MO or
cache and send it to the SCO box over network, even if only one file/call
is requested. Network and SCO box are very busy, so it may even take about
half an hour. It isn't really bad (users seldom complain about it), but it
could be much faster.

I'm about to work around it with something like this:

rcmd NJC "(
  taroffs archive.tar ${files_to_extract} | while read offset nbytes
  do
    dd < archive.tar iseek=$((offset/512)) count=$((nbytes/512))
    # OK, If SunOS 4.1.3's 'dd' does not support
    # 'iseek' or smthg like that, I will use my tool:
    # fildes archive.tar,${offset} : dd count=$((nbytes/512))
  done
)" | tar xvf -

Yes, this needs utility `taroffs`, which would print out offsets and sizes
for the specified files in the given archive. No problem, but:

The question is:

before I will code it (`taroffs`), I'd like to know, whether anyone knows
of some tar-like app, which has the option, which is missing in the
${subject}. Instead of restoring the files to disk, it should extract the
files to std. output as a smaller tar-archive. Note that it must support
also the 'q' option mentioned above and of course it must be able to
*lseek()* (in the archive) over files (not *read()* them), which are not
of interest. Otherwise, such option would be useless in this situation.

I'm looking either for SunOS 4.1.3 sparc binary or sources, which I would
be
able to compile on SunOS 4.1.3 (sun4c) or 5.[34] (sun4m/sparc).

Any other solution ?
No, NFS isn't part of SCO v4.2 Open Desktop Lite 3.0.0.

Thanks for reading this far and for your time.

--
Radek Tomis

2. No prompt at console

3. tar -cvf - | (cd dir; tar -xpvf - ) with changing access time?

4. continuous ARP:Bad packet received on device "eth0"!

5. tar xzf file or tar -xzf file?

6. Root has nice new icons, but not users!!!!

7. help copying large .tar and .tar.gz files

8. Need Artist for free software project

9. tar, list of files and files with spaces in the name

10. Archiving files in "date folders" based on date and time file generated

11. Need help to tar files in a directory older(creation date) than 45 days old

12. backup multiple tar-files on a tape using tar and mt - command

13. Extracting files with tar and uncompress fails with tar: Archive - EOF not on block boundary