Visit Our UNIX and Linux User Community

Basic script for monitor send mail service

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Basic script for monitor send mail service
# 1  
Old 05-22-2012
Java Basic script for monitor send mail service

Hi All

Need help
Can any one share a basic script that is used for monitor sendmail service whether online, offline.etc in solaris

Thanks in advance

Last edited by Scott; 05-22-2012 at 05:32 AM.. Reason: Removed email address
# 2  
Old 05-22-2012
The most basic would be...

1) Check whether process is running

ps -ef | grep smtpd #whatever the process name

2) Check whether relay host is alive on port 25 ( The default smtp port)
telnet host 25

And proceed accordingly.. Off-course you can-not send alert mail for this. What includes in your monitoring?
# 3  
Old 05-22-2012
Thanks for reply!!!

I just want to monitor like
If output of
bash-3.00$ svcs -a|grep sendmail
online Mar_08 svc:/network/smtp:sendmail

in this case it is online

i want script which send mail to concern team/ID whenever this service is not online
it may be either
disable etc

Can you share the script for this Smilie
# 4  
Old 05-22-2012
May be..

$ [ "$(svcs -H -o STATE smtp)" = "online" ] && echo running || echo not running

# 5  
Old 05-22-2012
yeah!!! that would be really helpful i guess.
Can you just send me the whole script that i can run the script and check
# 6  
Old 05-22-2012
Script is also a command ( set of commands) you just just put the above command in a file and run.

If you do want script like...
if [ "$(svcs -H -o STATE smtp)" = "online" ]; then 
 echo running
 echo not running

Previous Thread | Next Thread
Test Your Knowledge in Computers #863
Difficulty: Medium
Vue features a reactivity system that uses jQuery objects and optimized re-rendering.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Client was not authenticated to send anonymous mail during MAIL FROM (in reply to MAIL FROM comm

I am having trouble getting mail to work on a red hat server. At first I was getting this message. Diagnostic-Code: X-Postfix; delivery temporarily suspended: connect to :25: Connection refused Then added the port to my firewall. Then I temporarily turned off selinux. I then copied this file... (1 Reply)
Discussion started by: cokedude
1 Replies

2. Shell Programming and Scripting

Monitor a file and send mail

I want to monitor the maillog file in real time and send a mail when a certain grep condition is met. Every time the grep condition is met a mail will be sent. I wish to ignore all grep conditions 30 mins after each mail and thereafter continue monitoring. For example: Condition is met, mail... (1 Reply)
Discussion started by: proactiveaditya
1 Replies

3. 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

4. Shell Programming and Scripting

Monitor file if match then send mail

Hi I want to monitor a file even if the file rotate. When a text occurs I want to send a mail. Something like this but it's not working correctly: tail -F mylog.log | grep 'MatchMe' | while read line do echo $(date +"%Y-%m-%d %H:%M:%S") MatchMe occurs | mail -s "MatchMe"... (1 Reply)
Discussion started by: chitech
1 Replies

5. UNIX for Dummies Questions & Answers

Script to monitor BI service and trigger a mail

Hello friends, I am new to shell scripting.I am assigned a task in Unix to prepare a script which will check if OBI 10g services are running or not and to send email if the services are down.Any help will be appreciated. I tried searching for it in the blog and came across the following code ... (1 Reply)
Discussion started by: pradeep467
1 Replies

6. Windows & DOS: Issues & Discussions

[Template] Send SMTP email with Visual Basic Script (vbs) from Command Prompt using CDO

This is a script in visual basic that basically sends an email from an existing account, in this case the example is provided for It uses CDO (Collaboration Data Objects). All you need to do is replace the fields with the proper information. The email is send from Command Prompt... (0 Replies)
Discussion started by: Tribe
0 Replies

7. Shell Programming and Scripting

Looking for shell script to monitor CPU utilization and send mail once exceed 75%

Dear Group, I'm look for shell script to Monitor CPU usage and send mail once it exceed 75% I'm running Suse10.4. (3 Replies)
Discussion started by: clfever
3 Replies

8. Shell Programming and Scripting

Help-send mail script

Hi, I have written one script for sending mails with attachment. currently its working for only one recipient. I want to send mails to n number of users by taking user input i.e number of users. Output of current script: Enter how many files : 1 Enter First Name : kiran E-Mail... (2 Replies)
Discussion started by: kiran_j
2 Replies

9. Homework & Coursework Questions

monitor log entries and send e-mail

I am stuck and worried. My assignment was due a day ago and I was too busy completing other assignments due during the same time. I worry that not completing this assignment will fail me. Need urgent help in completing the script asap. I dont want to sound pushy to get the answer but just wanted to... (10 Replies)
Discussion started by: vin8465
10 Replies

10. Emergency UNIX and Linux Support

monitor log entries and send e-mail

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! I am stuck and worried. My assignment was due a day ago and I was too busy completing other assignments due during the same time. I worry that not completing this assignment... (1 Reply)
Discussion started by: vin8465
1 Replies

Featured Tech Videos