Alert to be triggered


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Alert to be triggered
# 8  
Old 09-07-2010
One idea for a script. Tested with "ksh" so may need adjustment for "bash".

Code:
address="myaddress@domain.com"
limit=90
df | grep -v "Filesystem" | while read line
do
        case "${line}" in
        "/dev/"*)       device="${line}"
                        ;;
        *)              percent=`echo "${line}"| \
                                awk '{print $4}'|sed -e "s/%//g"`
                        mountpoint=`echo "${line}"| \
                                awk '{print $5}'`
                        message="${device} ${mountpoint} ${percent}%"
                        if [ ${percent} -gt ${limit} ]
                        then
                                echo ""|mailx -s "${message}" "${address}"
                        fi
                        ;;
        esac
done

# 9  
Old 09-07-2010
Thanks a lot methyl. It seems it worked. I dint get a mail ( I guess SMTP, some mailing funcitonality is disabled). However the script executed but dint get any e-mail as such.

Anything else we should check regarding mailing?

Thanks once again.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Email need to be triggered

hi, Currently, in my code, the errors are written in log file. Additionally, i need to trigger the email of error captured. can we modify this script with email triggered along with existing command. echo "ERROR: $SCRIPT: $*" >>$LOGFILE (1 Reply)
Discussion started by: gowthamsoft
1 Replies

2. Shell Programming and Scripting

Scripts triggered via 'expect' - stderr lost

I have a bash script on server that runs fine when run interactively and writes stderr output to a file. However, when invoked through a 'expect' script run on Mac OS my laptop which does ssh to the server : generates the expected file, but file has no content. I suspect the stderr is getting... (1 Reply)
Discussion started by: sdudc
1 Replies

3. Shell Programming and Scripting

Windows exe file fails when triggered from ssh

Hi, I am triggering a windows exe file using the below command. ssh user@remoteserver command.exe -option1:xx /option2:yy This command is working fine from windows command prompt. When I am triggering the same command from ssh I get the error message cant load Any ideas to deal with... (2 Replies)
Discussion started by: ahmedwaseem2000
2 Replies

4. Shell Programming and Scripting

Current triggered time to epoch seconds

I have a requirement to find long running instances for notifying the stake holders based on the triggered time in AIX. I am not sure how to convert the triggered time to epoch seconds. For example : Current triggered time of instance is 13:06:19 -> how to convert this into epoch in the... (5 Replies)
Discussion started by: chandu123
5 Replies

5. Shell Programming and Scripting

Capture output of command triggered in background

Is there any way to trigger a sequence of commands in parallel and capture their output in variables? e.g. something on the following lines x=`echo "X" &` y=`echo "Y" &` z=`echo "Z" &` so that $x, $y, and $z evaluate to X, Y and Z res. (7 Replies)
Discussion started by: jawsnnn
7 Replies

6. Shell Programming and Scripting

Expect command when triggered by launchd

Hi folks, Im having trouble with an expect command in a shell script I use to back up mac os x servers. This one is being run on a 10.8.2 Server as part of a larger bash script. The script executes perfectly all the way through when triggered on the command line, but when launchd triggers it at... (4 Replies)
Discussion started by: rowie718
4 Replies

7. UNIX and Linux Applications

No alarm triggered when backup tape is full

Hi folks, i encountered an issue, no alarm is triggered when the tape is full on the Solaris server. The tape is 72GB. There is an alarm generating shell script in the server, which will trigger an alarm when it detects the tape is full. Hence, I will receive SMS and email alerts. This has been... (10 Replies)
Discussion started by: kimurayuki
10 Replies

8. Shell Programming and Scripting

ksh script not working if triggered by scheduler

I have a script that works well if i execute manually using informix user. However, it does not execute properly if triggered using the scheduler (ESP). This is the partial part where it doesn't work. i added some tracing but i can't figure it out. #!/bin/ksh let db_is_up=0... (6 Replies)
Discussion started by: tungaw2004
6 Replies

9. Shell Programming and Scripting

Unexpected results when triggered from cron

Following script gives different results when triggered from Cron compared to when triggered from command line. It is not able to assign values to some variables when triggered from cron. Can any one help? Its a very simple script Script - #! /bin/ksh sFile=$1 sEnv=$2 sWaitFile=$3... (1 Reply)
Discussion started by: sumeet
1 Replies

10. Shell Programming and Scripting

Even Driven (File triggered) shell script

Hi All I am not an expert at shell programming. But in the process of learning. But I have a requirement it goes as follows : Requirement 1: I have a series of files that keep comming on a unix folder every hour. The files names are different. As soon as a file arrives in this folder I will... (3 Replies)
Discussion started by: srivi_xinu
3 Replies
Login or Register to Ask a Question