![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Noob, script formatting query | benjo | Shell Programming and Scripting | 2 | 03-03-2008 04:37 AM |
| Why does my script not work? (Noob Alert) | bronkeydain | Shell Programming and Scripting | 4 | 02-21-2008 01:45 PM |
| can we create a GUI by shall script | johnray31 | Shell Programming and Scripting | 1 | 07-24-2007 07:47 AM |
| Using PHP script with crontab (NOOB) | Bobafart | UNIX for Dummies Questions & Answers | 5 | 04-26-2007 06:32 PM |
| how do I create an ftp script | leonard905 | UNIX for Dummies Questions & Answers | 2 | 01-14-2005 03:25 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
noob. need help to create a script.
Hi All.
im a noob to scripting. could somone help me with a script please. what i want to do is. 1. run a cmd in the script - qmqtool -s this will give me an output similar to this. Messages in local queue: 790 Messages in remote queue: 306 Messages in todo queue: 23 i then want to check if the message in the local queue is larger than the number of for example 100 ( but id like to be able to change this) if its larger i want to do. 2. send email to me@mydomain.com with the output of the qmqtool -s and saying something like this mail checker script has detected more than 100 emails in the local queue. Messages in local queue: 790 Messages in remote queue: 306 Messages in todo queue: 23 the script will automatically fix this issue. 3. service stop spamd 4. service stop drwebd 5. service restart xinetd thats all for now. ill run this script as a cron job every 1 hr. appreciate any help. cheers aron. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
To get the local queue, pipe the output of 'qmqtool -s' through awk.
Code:
lqueue_length=$(qmqtool -s | awk '/local queue/ {print $NF}')
if [ $lqueue_length -gt 100 ]; then
# send mail using mailx or whatever tool you use
# fix the problem in the next three lines
service stop spamd
service stop drwebd
service restart xinet
fi
|
||||
| Google The UNIX and Linux Forums |