LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-04-2011, 07:36 AM   #1
saran_redhat
Member
 
Registered: May 2009
Location: chennai
Posts: 247

Rep: Reputation: 16
Mqueue script


Hi,

Can anyone tel me how to create a script when my mailqueue (mqueue) folder size reaches 1GB and sent email alert to my email id.

Once mqueue folder size reaches the sent alert by mail.
Because everytime my mqueue folder size increasing.
Please help me.
 
Old 08-04-2011, 09:49 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,076

Rep: Reputation: 4377Reputation: 4377Reputation: 4377Reputation: 4377Reputation: 4377Reputation: 4377Reputation: 4377Reputation: 4377Reputation: 4377Reputation: 4377Reputation: 4377
Quote:
Originally Posted by saran_redhat View Post
Hi,
Can anyone tel me how to create a script when my mailqueue (mqueue) folder size reaches 1GB and sent email alert to my email id.

Once mqueue folder size reaches the sent alert by mail. Because everytime my mqueue folder size increasing.
Please help me.
Read the man pages on the du command. After that, write your script to check whatever directory you want, and act the way you want when certain conditions are met.

There are thousands of bash scripting tutorials you can easily find, if you tried to look. There are also many that do EXACTLY what you want, that you can download and modify. Have you even tried to look this up?
 
Old 08-05-2011, 05:10 AM   #3
saran_redhat
Member
 
Registered: May 2009
Location: chennai
Posts: 247

Original Poster
Rep: Reputation: 16
mqueue script

Quote:
Originally Posted by TB0ne View Post
Read the man pages on the du command. After that, write your script to check whatever directory you want, and act the way you want when certain conditions are met.

There are thousands of bash scripting tutorials you can easily find, if you tried to look. There are also many that do EXACTLY what you want, that you can download and modify. Have you even tried to look this up?
Hi

Thanks for the reply.

I tried.

this is my script


TO="sun@example.com"

SUBJ="Folder sie increased `hostname`"

MAIL="/bin/mail"

# 1GB
SIZE="1073741824"

# check the current size
#CHECK="`du /data/"
CHECK=$(du -bs /data | awk '{print $1}')

if [ "$CHECK" -gt "$SIZE" ]; then
"$MAIL" -s "$SUBJ" "$TO"
else
exit 1
fi

but not working. I dont know what mistake . please help me.

Thanks
 
Old 08-05-2011, 09:10 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,076

Rep: Reputation: 4377Reputation: 4377Reputation: 4377Reputation: 4377Reputation: 4377Reputation: 4377Reputation: 4377Reputation: 4377Reputation: 4377Reputation: 4377Reputation: 4377
Quote:
Originally Posted by saran_redhat View Post
Hi
Thanks for the reply. I tried. this is my script
Code:
TO="sun@example.com"
SUBJ="Folder sie increased `hostname`"
MAIL="/bin/mail"

# 1GB
SIZE="1073741824"

# check the current size
#CHECK="`du /data/"
CHECK=$(du -bs /data | awk '{print $1}')

if [ "$CHECK" -gt "$SIZE" ]; then
        "$MAIL" -s "$SUBJ" "$TO" 
else
        exit 1
fi
but not working. I dont know what mistake . please help me.
Maybe we could, if you told us WHAT isn't working. What error(s) do you see? What's going wrong?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mqueue priority golgon Programming 0 12-16-2009 01:53 AM
mqueue.h + no such file or directory kewl Linux - Software 2 07-28-2009 04:10 AM
Not able to clean up mqueue on servers vathsan AIX 2 10-20-2008 06:16 AM
Failure when create mqueue pewo Programming 4 12-29-2007 04:12 PM
What is /var/spool/mqueue?? WorldBuilder Linux - General 4 05-07-2003 02:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration