compress script


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers compress script
# 1  
Old 07-16-2003
compress script

Hi,

How wud I script a particular log file to be compressed at a particular time and to be uncompressed after say 2 hours ?

Im on a aix 3.2 box .

file to be compressed --- > # pwd
# /zssps/sps06/slogfile

Thanks
# 2  
Old 07-16-2003
I would imagine you could set up a cron job for each action - one that compresses, one that uncompresses.. Or have one cron job to run a script that compresses, sleeps in the background for two hours, then uncompresses..

Here's a tutorial - see if this maybe is what you want:

http://www.webmasters-central.com/t/cron.shtml
# 3  
Old 07-17-2003
now that link really helped... thanks again Oombera :|
# 4  
Old 07-17-2003
make a file :

Code:
#!/bin/ksh
# compress_file is written to compress a file and decompress after two hours.
# The time is tuneable by changing $time. $time is in seconds so two hours is 60 * 120(minutes)

file=$1
time="7200"

if [ -z "$file" ]
 then
  echo "Usage: /usr/local/bin/compress_file <file to compress>"
  exit 1
fi

/usr/bin/compress $file

sleep $time

/usr/bin/uncompress $file

added code tags for readability --oombera

Last edited by oombera; 02-18-2004 at 02:39 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to compress and delete the older logs

Hello Guys, Can you please help me with a script which zips the older log files(1-2 weeks) and delete them? I want to run the script manually instead of setting it up in a cron job. Appreciate your help. Regards, Kris (6 Replies)
Discussion started by: kriss.gv
6 Replies

2. Shell Programming and Scripting

script to compress files in directory that changes its name every day

Hi all I have the following script that should compress a file in a directory: # compress log files older than 2 days find /u01/easydone/DBDUMPS/*.dmp -mtime +2 -exec gzip {} \; BUT the problem is that these files that I want to compress are inside a directory with following format: ... (5 Replies)
Discussion started by: fretagi
5 Replies

3. Shell Programming and Scripting

Need script to compress the file for yesterday.

Hi, I want to write script for the last 5 files to compress. #!/bin/sh a= ls -ltr | awk '{print $9}' | head -5 | tail -3 echo `compress $a` exit 0 but this was telling "not found" please modify the script if i am wrong. (5 Replies)
Discussion started by: victory
5 Replies

4. Shell Programming and Scripting

Bash Script to Compress All Subdirectories

I'd like to create simple bash script that, given a directory, compresses each directory by name, e.g.: Contents of ~/Documents Folder1 Folder2 Folder3 compress-subdirectoies.sh ~/Documents Results: Folder1. Folder2. Folder2. Any advice would be appreciated (7 Replies)
Discussion started by: furashgf
7 Replies

5. Shell Programming and Scripting

Archive directory script with tar/compress

Hi all I need to write a script that archives all files with a certain date in the filename, to another location. It has to run on a AIX using tar/compress or another standard AIX tool. The directory will have x files, each prefixed with a date like yyyymmdd_desc.csv. I need all to... (7 Replies)
Discussion started by: AIXfrog
7 Replies

6. UNIX for Dummies Questions & Answers

Issue: Compress in unix server and FTP to windows and open the compress file using Winzip

Hi All ! We have to compress a big data file in unix server and transfer it to windows and uncompress it using winzip in windows. I have used the utility ZIP like the below. zip -e <newfilename> df2_test_extract.dat but when I compress files greater than 4 gb using zip utility, it... (4 Replies)
Discussion started by: sakthifire
4 Replies

7. Shell Programming and Scripting

how to write script in compress format

i have the script how to write script in compress format in tar (1 Reply)
Discussion started by: naveeng.81
1 Replies

8. Shell Programming and Scripting

script in saved in compress format

hi please help me i have scripts saved in compress format in sever Cherrs naveen.g (1 Reply)
Discussion started by: naveeng.81
1 Replies

9. Shell Programming and Scripting

unix script to takes the old data from a TXT file and compress them into new file

Hi, I am looking for the unix script which can takes the 2 month old data from a TXT file (there is one txt file in whiche messages are appended on daily basis) and compress them into new file.Please halp me out. (2 Replies)
Discussion started by: vpandey
2 Replies

10. Shell Programming and Scripting

script needed for compress

i hav 200 logs files in a folder i want compress only the files having size more than 10 mb . please provide a script (1 Reply)
Discussion started by: kingkhankk
1 Replies
Login or Register to Ask a Question