Sponsored Content
Full Discussion: Newbie Questions
Top Forums Shell Programming and Scripting Newbie Questions Post 64383 by mharley on Tuesday 1st of March 2005 09:08:42 AM
Old 03-01-2005
This is the script that I have written so far. It does not include any code for writing the messages to the temp file, or any code for sending the email.

Code:
#!/bin/ksh

DATEmonth='date +%m'
DATEday='date +%y'

#this puts the instance names in an array
set -A instance
instance[0]="ont0"
instance[1]="qbc1"
instance[2]="jdbc0"
instance[3]="ont5"
instance[4]="qbc5"
instance[5]="jdbc5"

#this puts the file names in an array
fName[0]="nohup.out"
fName[1]="PHLog.txt"
fName[2]="PSQTlog.txt"
fName[3]="response-Log.txt"
fName[4]="access.log
fName[5]="wl-domain.log"
fName[6]="weblogic.log"
fName[7]="ServiceAddressQueryResponse.Log.txt"

#loop through the instance and back up files
function setInstance(){
  for ((x=0; x<6; x++))
  do
    switch ($x)
      case 0:
        cd /opt/bea/ont0/wls6.1/config/bles/logs
        backupFiles(x)
      case 1:
        cd /opt/bea/qbc1/wls6.1/config/bles/logs
        backupFiles(x)
      case 2:
        cd /opt/bea/jdbc0/wls6.1/config/bles/logs
        backupFiles(x)
      case 3:
        cd /opt/bea/ont5/wls6.1/config/bles/logs
        backupFiles(x)
      case 4:      
        cd /opt/bea/qbc5/wls6.1/config/bles/logs
        backupFiles(x)
      case 5:
        cd /opt/bea/jdbc5/wls6.1/config/bles/logs
        backupFiles(x)
  done
}

function backupFiles{ 
  for ((y=0; y<8; y++))
  do 
    if [$fName[y] = "access.log"] || [$fName[y] = "weblogic.log"]
      then
        tar cvf $fName[y].$DATEmonth.tar $logfile.$DATEmonth*
        mv bk$fName[y].$DATEmonth.tar $fName[y]$DATEmonth_$DATEday.tar
        gzip $fName[y].$DATEmonth_$DATEday.tar
    el if [$fName[y] = "wl-domain.log"]
      then 
        tar cvf $fName[y].$DATEmonth_$DATEday.tar $fName[y]
        cp /dev/null/$fName[y]
        gzip $fName[y].$DATEmonth_$DATEday.tar
    else
      tar cvf bk$fName[y].$DATEmonth.tar $fName[y].$DATEmonth*
      mv bk$fName[y].$DATEmonth.tar $fName[y].$DATEmonth_$DATEday.tar
      gzip $fName[y].$DATEmonth_$DATEday.tar
    fi
  done
  mv *.tar.gz /u01/$instance[x]/
}

setInstance

From what I can determine (using uname) this is simply a Generic version of SunOS.

Does this make things any clearer?

Last edited by mharley; 03-01-2005 at 10:15 AM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

A few newbie questions

Hi :) I just wanted to ask a few basic questions really. I'm telnetting to a remote host and I've finally found out that I'm using a csh shell. My questions are: 1. Is the somename@something, the user group logged in? 2. How do I change user? I'm really lost so I hope someone can help... (7 Replies)
Discussion started by: hellz
7 Replies

2. UNIX for Dummies Questions & Answers

buncha questions from a newbie

Even though I have been logging in to a UNIX shell at school to complete school projects and write programs, but I had never really worked in UNIX environment. But a couple of weeks back I got hooked on to Solaris 9OE, read a book, a tutorial, a document provided on the Sun Microsystems website,... (1 Reply)
Discussion started by: init-5
1 Replies

3. Linux

Questions of a newbie

I have been an apple customer for years now, and am not satisfied with the direction that they are going. So I just ordered my first PC notebook the other day. I have no desire to use windows, however with microsoft's hold on the market, I feel that I may have a hard time doing this. I want to... (2 Replies)
Discussion started by: Brycemb16
2 Replies

4. UNIX for Dummies Questions & Answers

unix questions for newbie

Hi Unix gurus, I know these are some easy questions. But i just want to be sure about them. Hope someone can help explain the following please? 1) if ] - What does the "-r" means? 2) isql -U $DBUSER -D $DBNAME -S $DSQUERY -w 1000 -s";" << testfile > $FILE - What does the -s";" mean and... (1 Reply)
Discussion started by: gholdbhurg
1 Replies

5. UNIX for Dummies Questions & Answers

LISP newbie's questions

Hello, I want to learn LISP, and I have a GNU/Linux OS. I first sought a LISP compiler/interpreter and was told that GNU Emacs has a LISP mode. But I couldn't get into LISP mode, nor I don't know how to use it when I get into LISP mode. How can I run LISP code under GNU Emacs? And if... (1 Reply)
Discussion started by: rayne
1 Replies

6. Solaris

Solaris Newbie questions...

Hello everyone, I am brand spanking new to both Solaris and Unix. I thought I would give it a go after buying a SB2500 off ebay for a few hundred dollars. I am having some issues that I am not sure how to correct, and I am wondering if I can get a few pointers? The first one is that my system... (2 Replies)
Discussion started by: GeekMasterFlash
2 Replies

7. Shell Programming and Scripting

Perl newbie questions!

Hi, So I started to learn perl a few days ago, and I have some problems... One of my problems... #!C:\Perl64\bin\perl.exe -w use LWP::Simple; print "Content-Type: Text/Plain\n\n"; sub pagelinks { return @all = get($_) =~ /href\s*=\s*"?(+)/gis; } @a =... (5 Replies)
Discussion started by: byte1918
5 Replies

8. UNIX for Dummies Questions & Answers

Couple of newbie Unix questions

I entered a command at the prompt and it's interactive (not background). It gathers some stats and writes them to a file. I want to see this job running and what it's doing - I/O especially and maybe CPU and stuff. What can do to see this (say using a second session?) I know it's a long job but... (3 Replies)
Discussion started by: ido1957
3 Replies

9. AIX

Newbie Questions for AIX !!!

Hi Guys, I am new in this forum and new with AIX however not new with Power System. I have worked with iSeries for many years. Now supporting AIX on Power. Here are some basic questions I have. 1. I am using Putty to connect from my PC to the AIX boxes. Is there any other (better) program to... (6 Replies)
Discussion started by: 300zxmuro
6 Replies
BF_TAR(1)						    Bogofilter Reference Manual 						 BF_TAR(1)

NAME
bf_tar - shell script to write a tar file of a bogofilter directory to stdout SYNOPSIS
bf_tar [-r] [-R] bogofilter_directory DESCRIPTION
bf_tar bundles a bogofilter working directory in tar format and copies it to standard output (your console, or where you redirect it, see EXAMPLES below). OPTIONS
The -r option causes bf_tar to remove inactive log files after the archive has been written successfully. The default is to leave log files. The -R option causes bf_tar to remove inactive log files before the archive is written. This may reduce chances that the resulting archive is recoverable should it become damaged. The archive may be smaller though. The default is to leave log files. EXIT STATUS
The script exits with status code 0 if everything went well, and nonzero if it encountered trouble. EXAMPLES
o bf_tar ~/.bogofilter > outfile.tar Writes a standard .tar file containing the essential files from ~/.bogofilter to outfile.tar. o bf_tar ~/.bogofilter | gzip -9 -c > outfile.tar.gz Writes a gzipped .tar.gz file containing the essential files from ~/.bogofilter to outfile.tar.gz. o bf_tar `pwd`/mydirectory > outfile.tar Prepend $(pwd)/ or `pwd`/ if you want to specify an absolute path instead of a relative path. NOTES
This script is meant for use with Berkeley DB based bogofilter versions. This script requires a SUSv2 compliant pax utility. This script expects a SUSv2 compliant shell. Solaris systems should have the SUNWxcu4 package installed (when bogofilter is configured) so that /usr/xpg4/bin/sh can be used. AUTHORS
Matthias Andree Bogofilter 10/22/2012 BF_TAR(1)
All times are GMT -4. The time now is 10:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy