- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: crontab to send alert only once
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-13-2010 03:48 AM
тАО05-13-2010 03:48 AM
I am monitoring a port , if the number of connection on that port increases to more than one , i intend to send a mail .I intend to schedule this thru crontab , but the mail should go only once , even if the cron tab next run find more process listening on that port.
somethnig like :-
a=`/usr/local/bin/lsof -i tcp:21414 | grep -v "^COMMAND"| wc -l`
if [ $a >1]
then
send mail to this person
fi
---but if this runs thru crontab , and found again 3 process listening it will send the mail again , i want to avoid this second mail .
Please suggest.
Many Thanks in advance.
Regards ,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-13-2010 03:55 AM
тАО05-13-2010 03:55 AM
SolutionYou might record the number of connections in a file or even simply create a file to signify that more than one connection exists. Each time your script runs, test for the presence of the file (or read the number of connections recorded in it) and take the appropriate action.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-13-2010 04:05 AM
тАО05-13-2010 04:05 AM
Re: crontab to send alert only once
if [ $a >1 -a ! -f /tmp/mute.button ]
then
send mail to this person
touch /tmp/mute.button
fi
and a second job to run on Mondays, Wednesdays and Fridays?
rm /tmp/mute.button 2>>/dev/null
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-13-2010 04:37 AM
тАО05-13-2010 04:37 AM
Re: crontab to send alert only once
Thanks again.
Steve : why the second job to remove the /tmp/mute.button on
alternate days , and not daily. i want to send mail only once ,
everyday , if more than one process found.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-13-2010 04:44 AM
тАО05-13-2010 04:44 AM
Re: crontab to send alert only once
if [ $a >1]
then
if test -f /tmp/mail.lock.file
then
echo "do nothing "
else
send mail to this person
touch /tmp/mail.lock.file
fi
else
rm /tmp/mail.lock.file
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-13-2010 04:52 AM
тАО05-13-2010 04:52 AM
Re: crontab to send alert only once
For me, I wouldn't delete the mute button until I got back to work and fixed the problem. Then I would delete it by hand.
But I better not forget about it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-13-2010 05:49 AM
тАО05-13-2010 05:49 AM
Re: crontab to send alert only once
You could have a cron job send you an e-mail
message* if the marker file gets too old.
* Or shut down the system.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-13-2010 05:57 AM
тАО05-13-2010 05:57 AM
Re: crontab to send alert only once
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-13-2010 06:01 AM
тАО05-13-2010 06:01 AM
Re: crontab to send alert only once
/usr/bin/find /tmp \
-name mute.button \
-mtime +1 \
-type f \
-size 0 \
-exec rm {} \+
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-13-2010 06:19 AM
тАО05-13-2010 06:19 AM