Solved

Solaris 5.10 - using bash - script is not working

Posted on 2014-02-11
30
465 Views
Last Modified: 2014-02-11
Hi experts.

If the file name texfile has the following inside :
/sgpdbprd/ARCHIVES 9.9G

The following line is not working:

awk '$1 ~/ARCHIVES/ {if ($2 < 20.000) print $2, "    ",$1}' /export/home/oracle/dba/scripts/SGPDBPRD/textfile > /export/home/oracle/dba/scripts/SGPDBPRD/archives_space_tight

The file archive_space_tight is empty:
0
Comment
Question by:LindaC
  • 18
  • 12
30 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39850283
Hi again!

You'll have to get rid of the "G" to compare numerically, e.g. like this:

awk '$1 ~/ARCHIVES/ {sub("G","",$2); if ($2 < 20.000) print $2, "    ",$1}' ... ...
0
 
LVL 8

Author Comment

by:LindaC
ID: 39850293
Hi.  
Trying.
0
 
LVL 8

Author Comment

by:LindaC
ID: 39850308
/export/home/oracle/dba/scripts/SGPDBPRD> awk '$1 ~/ARCHIVES/ {sub("G","",$2); if ($2 < 20.000) print $2, "    ",$1}' /export/home/oracle/dba/scripts/SGPDBPRD/textfile > /export/home/oracle/dba/scripts/SGPDBPRD/archives_space_tight
awk: syntax error near line 1
awk: illegal statement near line 1
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39850355
Oh yes, I forgot - it's Solaris!

You'll have to use "nawk" or "/usr/xpg4/bin/awk" to make my suggestion work:

nawk '$1 ~/ARCHIVES/ {sub("G","",$2); if ($2 < 20.000) print $2, "    ",$1}' ... ...

/usr/xpg4/bin/awk '$1 ~/ARCHIVES/ {sub("G","",$2); if ($2 < 20.000) print $2, "    ",$1}' ... ...
0
 
LVL 8

Author Comment

by:LindaC
ID: 39850709
Thanks.
Trying.
0
 
LVL 8

Author Comment

by:LindaC
ID: 39850725
The file archives_space_tight is still empty


        9.9G    22K   9.9G     1%    /sgpdbprd/ARCHIVES


FS=/sgpdbprd/ARCHIVES
echo $FS `df -h | grep $FS | awk '{print $4}'` > /export/home/oracle/dba/scripts/SGPDBPRD/textfile
nawk '$1 ~/ARCHIVES/ {sub("G","",$2); if ($2 < 20.000) print $2, "    ",$1}' /export/home/oracle/dba/scripts/SGPDBPRD/textfile > /export/home/oracle/dba/scripts/SGPDBPRD/archives_space_tight
log=c
cd /export/home/oracle/dba/scripts/SGPDBPRD
PARAM1=`grep -c "ARCHIVES" "$log"`
if [[ "$PARAM1"  -gt "0" ]]; then
/export/home/oracle/dba/scripts/SGPDBPRD/rmovarch.sh
fi


empty archives_space_tight
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39850784
1) Are you sure that Solaris' "df" supports the "-h" flag? I don't think so!

2) If "-h" is supported, however - are you sure that archives_space_tight is indeed empty? What's in "textfile"? My tests (with "-h" supported) show a nice result.

3) What does this mean: "log=c"? You cannot use a string (or a single character) as a parameter to "grep". Or is "c" indeed a file?
0
 
LVL 8

Author Comment

by:LindaC
ID: 39850793
sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD> df -h
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c0d0s0         28G   8.5G    19G    32%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                    13G   1.7M    13G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/platform/sun4v/lib/libc_psr/libc_psr_hwcap2.so.1
                        28G   8.5G    19G    32%    /platform/sun4v/lib/libc_psr.so.1
/platform/sun4v/lib/sparcv9/libc_psr/libc_psr_hwcap2.so.1
                        28G   8.5G    19G    32%    /platform/sun4v/lib/sparcv9/libc_psr.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                    13G   168K    13G     1%    /tmp
swap                    13G    88K    13G     1%    /var/run
oracdb/apac            9.9G    88M   9.8G     1%    /apache
oracdb/dump             25G    34M    25G     1%    /dump_ora/sgpdbprd
oracdb/home            2.9G   366K   2.9G     1%    /home/oracle
oracdb/sgph            9.9G    23K   9.9G     1%    /home/sgp
oracdb/sgpf             30G    95M    30G     1%    /home/sgpfiles
oracdb/orac             20G   6.7G    13G    34%    /oracle
oracdb/arch            9.9G    22K   9.9G     1%    /sgpdbprd/ARCHIVES
oracdb/data             50G   6.7G    43G    14%    /sgpdbprd/DATA
oracdb/indx            9.9G   411M   9.5G     5%    /sgpdbprd/IDX
oracdb/red1            9.9G   1.8G   8.1G    18%    /sgpdbprd/REDO1
oracdb/red2            9.9G   1.8G   8.1G    18%    /sgpdbprd/REDO2
oracdb/red3            9.9G   1.8G   8.1G    18%    /sgpdbprd/REDO3
oracdb/syst            4.9G   1.8G   3.1G    37%    /sgpdbprd/SYSTEM
oracdb/temp            4.9G   1.0G   3.9G    21%    /sgpdbprd/TEMP
oracdb/undo            4.9G   231M   4.7G     5%    /sgpdbprd/UNDO
oracdb/back            9.9G    17M   9.9G     1%    /sgpdbprd/backup
You have new mail in /var/mail//oracle
sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD>
0
 
LVL 8

Author Comment

by:LindaC
ID: 39850801
-rwxr--r--   1 oracle   dba          811 Feb 11 12:51 verifica_archives.sh
-rw-r--r--   1 oracle   dba           24 Feb 11 13:00 textfile
-rw-r--r--   1 oracle   dba            0 Feb 11 13:00 archives_space_tight



sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD> cat verifica_archives.sh
PATH=/oracle/ora11g/bin:/usr/openv:/usr/openv/lib:/usr/bin:/etc:/usr/lbin:/usr/bin/X11:/usr/local/bin:/oracle/ora11g:/usr/sbin:/usr/css/bin:/usr/ucb:/usr/openv/netbackup/bin:/usr/bin/perl:/oracle/ora11g/OPatch:/oracle/ora11g/oui:/tmp:/usr/java6_64/bin
export PATH
FS=/sgpdbprd/ARCHIVES
echo $FS `df -h | grep $FS | awk '{print $4}'` > /export/home/oracle/dba/scripts/SGPDBPRD/textfile
nawk '$1 ~/ARCHIVES/ {sub("G","",$2); if ($2 < 20.000) print $2, "    ",$1}' /export/home/oracle/dba/scripts/SGPDBPRD/textfile > /export/home/oracle/dba/scripts/SGPDBPRD/archives_space_tight
log=/export/home/oracle/dba/scripts/SGPDBPRD/archives_space_tight
cd /export/home/oracle/dba/scripts/SGPDBPRD
PARAM1=`grep -c "ARCHIVES" "$log"`
if [[ "$PARAM1"  -gt "0" ]]; then
/export/home/oracle/dba/scripts/SGPDBPRD/rmovarch.sh
fi
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39850814
What's in texfile??

Could it be that the "df" you're using is an alias?

What do you get with

type df
or
whence -v df

?
0
 
LVL 8

Author Comment

by:LindaC
ID: 39850819
sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD> cat textfile
/sgpdbprd/ARCHIVES 9.9G
sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD> df
/                  (/dev/dsk/c0d0s0   ):40004690 blocks  3294225 files
/devices           (/devices          ):       0 blocks        0 files
/system/contract   (ctfs              ):       0 blocks 2147483605 files
/proc              (proc              ):       0 blocks    29918 files
/etc/mnttab        (mnttab            ):       0 blocks        0 files
/etc/svc/volatile  (swap              ):26914512 blocks  1112727 files
/system/object     (objfs             ):       0 blocks 2147483465 files
/etc/dfs/sharetab  (sharefs           ):       0 blocks 2147483646 files
/platform/sun4v/lib/libc_psr.so.1(/platform/sun4v/lib/libc_psr/libc_psr_hwcap2.so.1):40004690 blocks  3294225 files
/platform/sun4v/lib/sparcv9/libc_psr.so.1(/platform/sun4v/lib/sparcv9/libc_psr/libc_psr_hwcap2.so.1):40004690 blocks  3294225 files
/dev/fd            (fd                ):       0 blocks        0 files
/tmp               (swap              ):26914512 blocks  1112727 files
/var/run           (swap              ):26914512 blocks  1112727 files
/apache            (oracdb/apac       ):20581139 blocks 20581139 files
/dump_ora/sgpdbprd (oracdb/dump       ):52150439 blocks 52150439 files
/home/oracle       (oracdb/home       ): 6081008 blocks  6081008 files
/home/sgp          (oracdb/sgph       ):20761758 blocks 20761758 files
/home/sgpfiles     (oracdb/sgpf       ):62509581 blocks 62509581 files
/oracle            (oracdb/orac       ):27583539 blocks 27583539 files
/sgpdbprd/ARCHIVES (oracdb/arch       ):20761760 blocks 20761760 files
/sgpdbprd/DATA     (oracdb/data       ):90577652 blocks 90577652 files
/sgpdbprd/IDX      (oracdb/indx       ):19921040 blocks 19921040 files
/sgpdbprd/REDO1    (oracdb/red1       ):17072180 blocks 17072180 files
/sgpdbprd/REDO2    (oracdb/red2       ):17072182 blocks 17072182 files
/sgpdbprd/REDO3    (oracdb/red3       ):17072184 blocks 17072184 files
/sgpdbprd/SYSTEM   (oracdb/syst       ): 6514538 blocks  6514538 files
/sgpdbprd/TEMP     (oracdb/temp       ): 8176252 blocks  8176252 files
/sgpdbprd/UNDO     (oracdb/undo       ): 9802280 blocks  9802280 files
/sgpdbprd/backup   (oracdb/back       ):20726912 blocks 20726912 files




sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD> df -v
Mount Dir  Filesystem        blocks     used     free  %used
/          /dev/dsk/c0d0s0 28912822  8910499 19713195    32%
/devices   /devices               0        0        0     0%
/system/co ctfs                   0        0        0     0%
/proc      proc                   0        0        0     0%
/etc/mntta mnttab                 0        0        0     0%
/etc/svc/v swap             1682358      218  1682140     1%
/system/ob objfs                  0        0        0     0%
/etc/dfs/s sharefs                0        0        0     0%
/platform/sun4v/lib/libc_psr/libc_psr_hwcap2.so.1
/platform/                 28912822  8910499 19713195    32%
/platform/sun4v/lib/sparcv9/libc_psr/libc_psr_hwcap2.so.1
/platform/                 28912822  8910499 19713195    32%
/dev/fd    fd                     0        0        0     0%
/tmp       swap             1682161       21  1682140     1%
/var/run   swap             1682151       11  1682140     1%
/apache    oracdb/apac     20761804   180665 20581139     1%
/dump_ora/ oracdb/dump     52219084    68645 52150439     1%
/home/orac oracdb/home      6081740      732  6081008     1%
/home/sgp  oracdb/sgph     20761804       46 20761758     1%
/home/sgpf oracdb/sgpf     62704844   195263 62509581     1%
/oracle    oracdb/orac     41733324 14149794 27583530    34%
/sgpdbprd/ oracdb/arch     20761804       44 20761760     1%
/sgpdbprd/ oracdb/data     104647884 14070232 90577652    14%
/sgpdbprd/ oracdb/indx     20761804   840764 19921040     5%
/sgpdbprd/ oracdb/red1     20761804  3689624 17072180    18%
/sgpdbprd/ oracdb/red2     20761804  3689622 17072182    18%
/sgpdbprd/ oracdb/red3     20761804  3689620 17072184    18%
/sgpdbprd/ oracdb/syst     10276044  3761506  6514538    37%
/sgpdbprd/ oracdb/temp     10276044  2099792  8176252    21%
/sgpdbprd/ oracdb/undo     10276044   473764  9802280     5%
/sgpdbprd/ oracdb/back     20761804    34892 20726912     1%
sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD>
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39850853
With the contents of "textfile" you posted the "nawk" procedure works just fine for me.

What do you get on the commandline with:

sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD> nawk '$1 ~/ARCHIVES/ {sub("G","",$2); if ($2 < 20.000) print $2, "    ",$1}' textfile

?
0
 
LVL 8

Author Comment

by:LindaC
ID: 39850868
Nothing was returned:

sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD>  nawk '$1 ~/ARCHIVES/ {sub("G","",$2); if ($2 < 20.000) print $2, "    ",$1}' textfile
sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD>
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39850911
Very strange. This "nawk" seems a bit "exotic", to say the least.

Try

nawk '$1 ~/ARCHIVES/ {print}' textfile

nawk '$1 ~/ARCHIVES/ {sub("G","",$2); print}' textfile
0
 
LVL 8

Author Comment

by:LindaC
ID: 39851270
Trying .
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 8

Author Comment

by:LindaC
ID: 39851275
sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD> nawk '$1 ~/ARCHIVES/ {print}' textfile
/sgpdbprd/ARCHIVES 9.9G
You have new mail in /var/mail//oracle
sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD> nawk '$1 ~/ARCHIVES/ {sub("G","",$2); print}' textfile
/sgpdbprd/ARCHIVES 9.9
sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD>
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39851325
OK so far. And this?

nawk '$1 ~/ARCHIVES/ {sub("G","",$2); if ($2 < 20) print $2, "    ",$1}' textfile
0
 
LVL 8

Author Comment

by:LindaC
ID: 39851341
Executed two times:

sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD> nawk '$1 ~/ARCHIVES/ {sub("G","",$2); if ($2 < 20) print $2, "    ",$1}' textfile
You have new mail in /var/mail//oracle
sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD> nawk '$1 ~/ARCHIVES/ {sub("G","",$2); if ($2 < 20) print $2, "    ",$1}' textfile
sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD>
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 39851419
So it's probably the number format which nawk doesn't understand.

I fear we will have to go away from the human readable format to pure blocks.

You want to check for less than 20 GB free space, and 20 GB is equivalent to 41943040 blocks.

FS=/sgpdbprd/ARCHIVES
echo $FS `df -v | grep $FS | awk '{print $5}'` > /export/home/oracle/dba/scripts/SGPDBPRD/textfile
nawk '$1 ~/ARCHIVES/ {if ($2 < 41943040) print $2, "    ",$1}' /export/home/oracle/dba/scripts/SGPDBPRD/textfile > /export/home/oracle/dba/scripts/SGPDBPRD/archives_space_tight

We can also work step by step, to see what's it all about:

FS=/sgpdbprd/ARCHIVES

echo $FS `df -v | grep $FS | awk '{print $5}'`
echo $FS `df -v | grep $FS | awk '{print $5}'` > textile
cat textfile
nawk '$1 ~/ARCHIVES/ {if ($2 < 41943040) print $2, "    ",$1}' textfile
nawk '$1 ~/ARCHIVES/ {if ($2 < 41943040) print $2, "    ",$1}' textfile > archives_space_tight
cat archives_space_tight
grep -c "ARCHIVES" archives_space_tight
PARAM1=`grep -c "ARCHIVES" archives_space_tight`
echo $PARAM1
if [[ $PARAM1  -gt 0 ]]; then echo "Need to run rmovarch.sh"; fi
0
 
LVL 8

Author Comment

by:LindaC
ID: 39851452
sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD> ./test.sh
/sgpdbprd/ARCHIVES
/sgpdbprd/ARCHIVES 9.9G
0
0
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39851499
Typo, sorry.

In the second line it must be "textfile", NOT "textile"
0
 
LVL 8

Author Comment

by:LindaC
ID: 39851516
Lol, so curious ! I'am taking sewing classes.

Trying
0
 
LVL 8

Author Comment

by:LindaC
ID: 39851520
Now it run successfully.
Thank you.

sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD> ./test.sh
/sgpdbprd/ARCHIVES
/sgpdbprd/ARCHIVES
      /sgpdbprd/ARCHIVES
      /sgpdbprd/ARCHIVES
1
1
Need to run rmovarch.sh
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39851613
>> Now it run successfully. <<

 I don't think so. Shouldn't there be numbers following    "/sgpdbprd/ARCHIVES"?

Did you really use "df -v"? Maybe we must use "/usr/xpg4/bin/df -P" instead.

Please post again the full results of "df -v" and "/usr/xpg4/bin/df -P"
0
 
LVL 8

Author Comment

by:LindaC
ID: 39851618
Trying
0
 
LVL 8

Author Comment

by:LindaC
ID: 39851623
sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD> df -v
Mount Dir  Filesystem        blocks     used     free  %used
/          /dev/dsk/c0d0s0 28912822  8911076 19712618    32%
/devices   /devices               0        0        0     0%
/system/co ctfs                   0        0        0     0%
/proc      proc                   0        0        0     0%
/etc/mntta mnttab                 0        0        0     0%
/etc/svc/v swap             1681564      218  1681346     1%
/system/ob objfs                  0        0        0     0%
/etc/dfs/s sharefs                0        0        0     0%
/platform/sun4v/lib/libc_psr/libc_psr_hwcap2.so.1
/platform/                 28912822  8911076 19712618    32%
/platform/sun4v/lib/sparcv9/libc_psr/libc_psr_hwcap2.so.1
/platform/                 28912822  8911076 19712618    32%
/dev/fd    fd                     0        0        0     0%
/tmp       swap             1681367       21  1681346     1%
/var/run   swap             1681358       12  1681346     1%
/apache    oracdb/apac     20761804   180665 20581139     1%
/dump_ora/ oracdb/dump     52219084    69006 52150078     1%
/home/orac oracdb/home      6081740      732  6081008     1%
/home/sgp  oracdb/sgph     20761804       46 20761758     1%
/home/sgpf oracdb/sgpf     62704844   195263 62509581     1%
/oracle    oracdb/orac     41733324 14149905 27583419    34%
/sgpdbprd/ oracdb/arch     20761804       44 20761760     1%
/sgpdbprd/ oracdb/data     104647884 14070232 90577652    14%
/sgpdbprd/ oracdb/indx     20761804   840764 19921040     5%
/sgpdbprd/ oracdb/red1     20761804  3689626 17072178    18%
/sgpdbprd/ oracdb/red2     20761804  3689624 17072180    18%
/sgpdbprd/ oracdb/red3     20761804  3689622 17072182    18%
/sgpdbprd/ oracdb/syst     10276044  3761506  6514538    37%
/sgpdbprd/ oracdb/temp     10276044  2099792  8176252    21%
/sgpdbprd/ oracdb/undo     10276044   473764  9802280     5%
/sgpdbprd/ oracdb/back     20761804    34892 20726912     1%
You have new mail in /var/mail//oracle
sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD> /usr/xpg4/bin/df -P
Filesystem            512-blocks        Used   Available Capacity  Mounted on
/dev/dsk/c0d0s0         57825644    17822160    39425228    32%    /
/devices                       0           0           0     0%    /devices
ctfs                           0           0           0     0%    /system/contract
proc                           0           0           0     0%    /proc
mnttab                         0           0           0     0%    /etc/mnttab
swap                    26905024        3488    26901536     1%    /etc/svc/volatile
objfs                          0           0           0     0%    /system/object
sharefs                        0           0           0     0%    /etc/dfs/sharetab
/platform/sun4v/lib/libc_psr/libc_psr_hwcap2.so.1
                        57825644    17822160    39425228    32%    /platform/sun4v/lib/libc_psr.so.1
/platform/sun4v/lib/sparcv9/libc_psr/libc_psr_hwcap2.so.1
                        57825644    17822160    39425228    32%    /platform/sun4v/lib/sparcv9/libc_psr.so.1
fd                             0           0           0     0%    /dev/fd
swap                    26901872         336    26901536     1%    /tmp
swap                    26901728         192    26901536     1%    /var/run
oracdb/apac             20761804      180665    20581139     1%    /apache
oracdb/dump             52219084       69006    52150078     1%    /dump_ora/sgpdbprd
oracdb/home              6081740         732     6081008     1%    /home/oracle
oracdb/sgph             20761804          46    20761758     1%    /home/sgp
oracdb/sgpf             62704844      195263    62509581     1%    /home/sgpfiles
oracdb/orac             41733324    14149905    27583419    34%    /oracle
oracdb/arch             20761804          44    20761760     1%    /sgpdbprd/ARCHIVES
oracdb/data            104647884    14070232    90577652    14%    /sgpdbprd/DATA
oracdb/indx             20761804      840764    19921040     5%    /sgpdbprd/IDX
oracdb/red1             20761804     3689626    17072178    18%    /sgpdbprd/REDO1
oracdb/red2             20761804     3689624    17072180    18%    /sgpdbprd/REDO2
oracdb/red3             20761804     3689622    17072182    18%    /sgpdbprd/REDO3
oracdb/syst             10276044     3761506     6514538    37%    /sgpdbprd/SYSTEM
oracdb/temp             10276044     2099792     8176252    21%    /sgpdbprd/TEMP
oracdb/undo             10276044      473764     9802280     5%    /sgpdbprd/UNDO
oracdb/back             20761804       34892    20726912     1%    /sgpdbprd/backup
sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD>
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39851637
As I suspected. Let's try it again.

FS=/sgpdbprd/ARCHIVES

echo $FS `/usr/xpg4/bin/df -P | grep $FS | awk '{print $4}'`
echo $FS `/usr/xpg4/bin/df -P | grep $FS | awk '{print $4}'` > textfile
cat textfile
nawk '$1 ~/ARCHIVES/ {if ($2 < 41943040) print $2, "    ",$1}' textfile
nawk '$1 ~/ARCHIVES/ {if ($2 < 41943040) print $2, "    ",$1}' textfile > archives_space_tight
cat archives_space_tight
grep -c "ARCHIVES" archives_space_tight
PARAM1=`grep -c "ARCHIVES" archives_space_tight`
echo $PARAM1
if [[ $PARAM1  -gt 0 ]]; then echo "Need to run rmovarch.sh"; fi
0
 
LVL 8

Author Comment

by:LindaC
ID: 39851647
It seems that now it run successfully.

sgpprd:/export/home/oracle/dba/scripts/SGPDBPRD> ./test.sh
/sgpdbprd/ARCHIVES 20761760
/sgpdbprd/ARCHIVES 20761760
20761760      /sgpdbprd/ARCHIVES
20761760      /sgpdbprd/ARCHIVES
1
1
Need to run rmovarch.sh
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39851736
OK, looks perfect now.

So this is the full version:


FS=/sgpdbprd/ARCHIVES
echo $FS `/usr/xpg4/bin/df -P | grep $FS | awk '{print $4}'` > /export/home/oracle/dba/scripts/SGPDBPRD/textfile
nawk '$1 ~/ARCHIVES/ {if ($2 < 41943040) print $2, "    ",$1}' /export/home/oracle/dba/scripts/SGPDBPRD/textfile > /export/home/oracle/dba/scripts/SGPDBPRD/archives_space_tight
log=/export/home/oracle/dba/scripts/SGPDBPRD/archives_space_tight
cd /export/home/oracle/dba/scripts/SGPDBPRD
PARAM1=`grep -c "ARCHIVES" "$log"`
if [[ $PARAM1  -gt 0 ]]; then
/export/home/oracle/dba/scripts/SGPDBPRD/rmovarch.sh
fi

Have a nice evening!

wmp
0
 
LVL 8

Author Comment

by:LindaC
ID: 39851795
Thanks. You too.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now