script to monitor partition cant execute


 
Thread Tools Search this Thread
Operating Systems Solaris script to monitor partition cant execute
# 1  
Old 06-25-2008
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  
Old 06-25-2008
run the script with "set -xv" and post the output.

one thing can be "expr $i"...
# 3  
Old 06-25-2008
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  
Old 06-25-2008
... 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  
Old 06-26-2008
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  
Old 06-26-2008
Could it be something related to mailx command

Are you able to run mailx command successfully?
# 7  
Old 06-27-2008
Hi csenewbie
First, i'm not very familiar with the mailx command either its right or not.
Kindly can u give me the right command in order to run mailx command successfully. I'll test this first.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Script monitor website wth default tomcat script

Hi all, on our application server we have the following script that monitor the status of the website, my problem here is that i have edite the retries from 3 to 5, and the timewait to 120 second, so the script should check 5 times every 2 minutes, and if the fifth check fails it must restart... (0 Replies)
Discussion started by: charli1
0 Replies

2. Infrastructure Monitoring

Searching for Saas Monitor service which monitor my servers which are sitting in different providers

Sorry if this is the wrong forum Searching for Saas Monitor service which monitor my servers which are sitting in different providers . This monitor tool will take as less CPU as possible , and will send info about the server to main Dashboard. The info I need is CPU / RAM / my servers status (... (1 Reply)
Discussion started by: umen
1 Replies

3. Red Hat

Shrink LVM partition & create new Linux Primary partition

Hello All, I have a Red Hat Linux 5.9 Server installed with one hard disk & 2 Partitions created on it as follows, /boot - Linux Partition & another is LVM - One VG & under that 5-6 Logical volumes(var,opt,home etc). Here my requirement is to take out 1GB of space from LVM ( Any logical... (5 Replies)
Discussion started by: gr8_usk
5 Replies

4. Filesystems, Disks and Memory

Ask concept soft partition vs hard partition

Hi Experts I would like to know different between soft partition concept and hard partition concept on solaris. Here is little explanation between soft partition concept and hard partition concept on solaris. Soft Partition: 1TB total space available in storage in all mapped to the OS to... (2 Replies)
Discussion started by: edydsuranta
2 Replies

5. Solaris

Partition overlaps another partition while creating new parition in solaris

hi all while formatting hard disk i am getting following error. Partition 1 ends at 266338338 It must be between 34 and 143374704. label error: EFI Labels do not support overlapping partitions Partition 8 overlaps partition 1. Warning: error writing EFI. Label failed. I have formatted the... (2 Replies)
Discussion started by: nikhil kasar
2 Replies

6. Shell Programming and Scripting

Monitor log file and execute command

I would like to monitor a log file using a shell script and as soon as a line with a certain string in it appears I would like to run a program. I have been playing around with doing this using tail -f, but cannot get it to work. I found something similar here:... (1 Reply)
Discussion started by: danielsbrewer
1 Replies

7. Shell Programming and Scripting

script execute or no execute

o hola.. Tengo un script que se ejecuta bajo una tarea del CronJOb del unix, tengo la version 11 de unix, mi script tiene un ciclo que lee unos archivos .txt luego cada uno de esos archivos debe pasar por un procedimiento almacenado el cual lo tengo almacenado en mi base de datos oracle 10g,... (4 Replies)
Discussion started by: Kespinoza97
4 Replies

8. UNIX for Dummies Questions & Answers

I've created a partition with GNU Parted, how do I mount the partition?

I've created a partition with GNU Parted, how do I mount the partition? The manual information at http://www.gnu.org/software/parted/manual/parted.html is good, but I am sure about how I mount the partition afterwards. Thanks, --Todd (1 Reply)
Discussion started by: jtp51
1 Replies

9. UNIX for Dummies Questions & Answers

understanding logical partition, physical partition

hi, 1) is logical partition the same as physical partition except that one is physical and the other is logical? 2) then it must a one to one ratio? (3 Replies)
Discussion started by: yls177
3 Replies
Login or Register to Ask a Question