![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| executing script by cron doesnt give me expected result | anchal_khare | UNIX for Advanced & Expert Users | 1 | 09-12-2007 09:07 AM |
| Command doesn't work under cron ? | bigjohn-nj | Shell Programming and Scripting | 4 | 01-20-2006 04:38 PM |
| script didn;t work in cron !!! @_@ | stancwong | Shell Programming and Scripting | 2 | 10-04-2005 10:25 AM |
| ncopy doesn't work from cron | Selma | UNIX for Dummies Questions & Answers | 2 | 01-20-2005 09:28 AM |
| Simple cron job won't work | coregan | UNIX for Dummies Questions & Answers | 4 | 01-20-2004 05:22 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Script doesn't work as expected when run on cron
The script checks for free space stats on Oracle. If there are any tablespaces with more than 85% usage it prints the details of the tablespace. If all the tablespaces have more than 15% free space, then "All tablespaces have more than 15 pct free space" must be printed on the screen.
When I run on the shell with ./scriptname it runs as described above. When I run it as a cron job, I do not get the message "All tablespaces have more than 15 pct free space"when all tablespaces have more than 15% free space. I am pasting a part of the script: # call Oracle script to query tablespace size `sqlplus -S "/as sysdba" @/home/sidadm/script/dba_data_files.sql > .tmp1` # call Oracle script to query freespace in tablespace `sqlplus -S "/as sysdba" @/home/sidadm/script/dba_free_space.sql > .tmp2` # paste them into a single file paste .tmp1 .tmp2 |tail +4 > .tmp # get the number of tablespaces TS_CT=`cat .tmp | wc -l` awk -v m=0 -v n=0 -v i="$TS_CT" ' { # calculate freespace percentage k =$3/$2*100; # print the details if the percentage of freespace is less than 15 if($3/$2*100 < 15) { m = m + 1; # m keeps a count of number of tablespaces with freespace percentage less than 15 if(m==1) # print the heading (only once) { printf("%s \n","Tablespaces having less than 15pct freespace GB") printf("%s \n","Tablespace Totalspace Freespace Freespace_pct") } len =length ($1) printf("%s",$1) for ( ;len < 30 ;len++) { printf("%c"," "); } len=length($2) printf("%s",$2) for ( ;len < 15 ;len++) { printf("%c"," "); } len = length($3); printf("%s",$3) for ( ;len < 15 ;len++) { printf("%c"," "); } printf("%f \n ",$3/$2*100); } else { n = n + 1; # n keeps a count of tablespaces with freespace percentage more than 15 if(n==i) # if all the tablespaces have free space more than 15 % { printf("%s \n","All tablespaces have more than 15 pct free space") } } } ' .tmp >> $TOBREMAILED |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|