Hi,
i want to zip the files that generates automatically
every few minutes (files generated are in .arc
extension)....any body write a script for this...
thanks in advance
Answer Posted / narendrasairam
One way is to keep the code snippet in while loop with a
sleep time of 300 seconds (expecting 5 minutes time gap)
while true
do
FILE_EXIST_CHECK=`ls -l | grep ^- | wc -l`
if [ $FILE_EXIST_CHECK -ne 0 ];
then
if [ -f *.arc ];
then
ls *.arc > arc_files.lst
while read arc_filename
do
/usr/local/bin/gzip $arc_filename > /dev/null 2>&1
done < arc_files.lst
fi
else
echo " There are no .arc files existing...."
fi
sleep 300;
done
The other way is to schedule the job using crontab with a
time slice of minutes with out keeping in while true loop.
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is scripting used for?
How can we find the process name from its process id?
What are the advantages of shell scripting?
How do I run a script from command prompt?
how will you find the total disk space used by a specific user?
What is the meaning of $1 in shell script?
How to get the 3rd element/column from each line from a file?
What is bash used for?
What is the conditional statement in shell scripting?
What are different types of shell?
What is a program shell?
How do I save a powershell script?
What does sh mean?
Is shell script a programming language?
Devise a script that takes file name as arguement(which must present in the current directory)and locates from your home directory tree all thpath names of its links.Then mail the list to self.