Scripting question 
Author Message
 Scripting question

Howdy.  I hope people don't mind this post but I am a newbie to awk and
have a quick question.
I am trying to create a simple 'rotatelogs' file that will take contents
from several different directories and create a backup copy of each and
then create a new copy again.
For example:
I want to go into each of these directories;
    /export/home/joe
    /export/home/tim
    /export/home/moe
    /export/home/sue
and grab a file that is called the same in each of the different
directories, for example 'details' and then rotate it, i.e. mv 'details'
to 'details.bak' and then touch 'details' so that it is recreated.
Would someone have a nice clean example that I can take a look at.  I
don't want anyone to write this for me, but simply point me in a
direction where I can see an example.
Thanks.  I'm very appreciative and wish to learn as much as I can.
If this is the wrong newsgroup, I apologize.
KJ


Fri, 20 Apr 2001 03:00:00 GMT  
 Scripting question

% Howdy.  I hope people don't mind this post but I am a newbie to awk and
% have a quick question.

You want comp.unix.shell for this, I'd say.

% I am trying to create a simple 'rotatelogs' file that will take contents
% from several different directories and create a backup copy of each and
% then create a new copy again.

It's a little difficult to point you in the right directory without
solving the problem completely. I'll make it as cryptic as possible, and
I won't test it so you'll still have things to do with it:

 #!/usr/bin/ksh
 for a in /export/home/+(joe|tim|moe|sue)
 do
   # you could loop through a variable here, creating endless
   # generations of back-ups

   if [ -f $a/details.back ]; then
     mv $a/details.back $a/details.front
   fi

   if [ -f $a/details ]; then
     mv $a/details $a/details.back
   fi

   touch $a/details
 done

--

Patrick TJ McPhee
East York  Canada



Sat, 21 Apr 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Pretty easy (I think) shell script question

2. URGENT: Shell scripting question

3. Shell script questions...

4. AWK script question

5. script question

6. hugs scripting question

7. REXX OS2 Notify Script QUestion...

8. scripting question

9. scripting question

10. a script question

11. scripting question

12. Dumb Java Script Question

 

 
Powered by phpBB® Forum Software