The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Operating Systems > SUN Solaris
.
google unix.com



SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
server monitor script... zedex Shell Programming and Scripting 1 06-01-2008 05:10 PM
script execute or no execute Kespinoza97 Shell Programming and Scripting 4 06-23-2007 10:27 AM
need help doing a script to monitor if files are go through jonathan184 Shell Programming and Scripting 0 05-15-2007 12:47 PM
load monitor script locabuilt UNIX for Advanced & Expert Users 7 01-19-2007 02:37 PM
Hep with script to monitor directory cmf00186 UNIX for Dummies Questions & Answers 2 10-25-2006 03:42 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 5.00 average. Display Modes
  #1 (permalink)  
Old 06-25-2008
adzuanamir adzuanamir is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 40
script to monitor partition cant execute

Hi...
I'm trying to run this script by using cronjob but it doesnt work. The purpose of this script is to monitor my oracle database partition when the size is less than 1gb, the script will trigger an email to my email address to alert about partition size
-------------------------------------------------------------------------
check_filesystem_size.ksh
-------------------------------------------------------------------------
#!/bin/ksh

for i in `df -k|grep /u0|awk '{ print $4 }'`
do
# Convert the file size to a numeric value
filesize=`expr i`

# If any filesystem has less than 1000k, issue an alert
if [ $filesize -lt 1000 ]
then
mailx -s "Oracle filesystem $i has less than 1000k free."\
adzuan@nc.com.my
fi
done
----------------------------------------------------------------------

Crontab line:

0 0 * * * /ek_ora/script/check_filesystem_size.ksh > dev/null >&1

----------------------------------------------------------------------

The error from /var/mail/oracle

Your "cron" job on jupm-wp11
/ek_ora/script/check_oracle_filesystem.ksh > /dev/null >&1

produced the following output:

sh: /ek_ora/script/check_oracle_filesystem.ksh: not found
-----------------------------------------------------------------------

Can anybody tell me why the script doesnt work??

Last edited by adzuanamir; 06-25-2008 at 01:43 AM..
  #2 (permalink)  
Old 06-25-2008
DukeNuke2's Avatar
DukeNuke2 DukeNuke2 is offline Forum Staff  
Soulman
  
 

Join Date: Jul 2006
Location: Germany, Berlin
Posts: 2,991
run the script with "set -xv" and post the output.

one thing can be "expr $i"...
  #3 (permalink)  
Old 06-25-2008
adzuanamir adzuanamir is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 40
hi Duke
i changed to expr $i
i run the script like this :
----------------------------------------
bash-3.00$ set -xv
bash-3.00$ ./check_oracle_filesystem.ksh
./check_oracle_filesystem.ksh
+ ./check_oracle_filesystem.ksh
----------------------------------------

it just hung....
  #4 (permalink)  
Old 06-25-2008
System Shock's Avatar
System Shock System Shock is offline Forum Advisor  
Registered User
  
 

Join Date: May 2006
Location: Tau Ceti V
Posts: 521
... well, the logfile is telling you the error:

Code:
sh: /ek_ora/script/check_oracle_filesystem.ksh: not found

.. but the crontab you posted says:

Code:
0 0 * * * /ek_ora/script/check_filesystem_size.ksh > dev/null >&1

What's the actual name of the script?
What's actually in crontab?
  #5 (permalink)  
Old 06-26-2008
adzuanamir adzuanamir is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 40
Hi There
Yeah my bad at the crontab
I just change the value to the right file name at the crontab
But although i run manually, still got error:

----------------------------------------------------------------------
-bash-3.00$ sh -x ./ek_ora/script/check_oracle_filesystem.ksh > a.out
+ + df -k
awk { print $4 }
+ grep /ek_
+ expr 0
filesize=0
+ [ 0 -lt 100 ]
+ mailx -s Oracle filesystem 0 has less than 100k free. adzuan@nc.com.my
---------------------------------------------------------------------

The script is just hung there....
  #6 (permalink)  
Old 06-26-2008
csenewbie csenewbie is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 1
Could it be something related to mailx command

Are you able to run mailx command successfully?
  #7 (permalink)  
Old 06-27-2008
denn denn is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 96
With the format you're using for mailx, it will definately hang forever.
this format will "from command line" give you a new line, where you type in a message, and every newline will do the same, until you type in a . "dot"
then it will send all the text you typed in with the subject.

mailx expects a message of some sort, by default, not just a subject!

The correct format within a script is:


Code:
mailx -s "subject" email_address < FILENAME > /dev/null 2>&1
# or if you don't want to use a file
mailx -s "subject" email_address << EOD > /dev/null 2>&1
EOD

if you don't redirect to /dev/null it'll complain about an empty message, and cron will not like that.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:17 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0