The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell script answer prompts? eltinator Shell Programming and Scripting 4 08-29-2007 12:15 PM
pkgadd pkgask still prompts for user input prkfriryce SUN Solaris 1 06-28-2007 01:27 PM
run a application from a remote server via script? yankee428 Shell Programming and Scripting 4 10-26-2005 05:11 PM
Script to Test Application Server is running duglover UNIX for Dummies Questions & Answers 0 04-28-2004 10:47 AM
Providing a Link to Perl brahill UNIX for Dummies Questions & Answers 4 10-10-2000 09:37 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-08-2005
mitch8 mitch8 is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 2
script providing input to application prompts

Hi!

I want to write a script that will create an archive (via tar) that will restrict the size of the tar file. The size can be constrained using the keyword 'k' and providing the size restriction. The problem is that the script needs to know (detect) when the tar command prompts the user (which will be this script) so that the script can copy the tar file to a temporary file (like tarFileName.1) and then return control back to the tar command to create the next volume.

(hope you could follow that logic)

My problem is I know of no mechanism in scripting in unix that allows for this kind of command flow control. Does it exist? Can anyone suggest a method I can use for this? (interrupt handlers; subs; ....)

tia,
mitch

ps the reason for needing to limit the size is to allow a customer to ftp some huge subdirectories (>10Gb) in bitesize pieces. The script will first gzip all the files, then archive them into volumes of, say, 100Mb in size. But the tar command prompts the user to change the archive media and hit RETURN to continue. The operator needs to copy the tar file to some other file, then hit return for this method to work.
  #2 (permalink)  
Old 02-09-2005
Phantom Phantom is offline
Registered User
  
 

Join Date: Feb 2005
Location: Holon, Israel
Posts: 26
You can do it in much simpler way in three steps:

1. Create the full archive file xxx.tar.gz or xxx.tar.

2. split -b <size> xxx.tar.gz
where <size> is the size of single piece.

3. mv xaa xxx_1.tar.gz
mv xab xxx_2.tar.gz
.................................


In order to reassable the pieces togather again

cat xxx_1.tar.gz xxx_2.tar.gz ..... xxx_N.tar.gz > myarchive.tar.gz
  #3 (permalink)  
Old 02-09-2005
mitch8 mitch8 is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 2
thanks

ya gotta like simple - thanks

mitch
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:57 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0