4 ms·
Grab the Nagios plugins tarball, build it on linux, and find the check_tcp program. Wrap a little shell program around check_tcp that will either do nothing, o
by spudlyo 17y ago
Grab the Nagios plugins tarball, build it on linux, and find the check_tcp program. Wrap a little shell program around check_tcp that will either do nothing, or fire off your script depending on the return code of check_tcp. Run this once a minute out of cron. Make sure these scripts won't stack up, by either setting check_tcp's socket timeout to less than 60 seconds, or have the script initially check to make sure no other of its kind are running.
- moe 17y agoMake sure these scripts won't stack up And that's exactly why you don't roll these things on your own unless you have a very good reason. Making sure a cronjob doesn't stack up reliably is non-trivial and becomes extremely hairy when the network gets involved. Many people think "I'll just use a lockfile" - think again. Since for monitoring scripts this kind of reliability is the whole point, I strongly suggest to use something like monit where someone else has already worked out all the little corner cases.
- deleted 17y ago[deleted]
- spudlyo 17y agoThe OP is not likely interested in monitoring software advocacy, he wants "a quick & dirty way to guarantee a good nights sleep" while his buddy is on vacation. I still think a smart wrapper around check_tcp is the way to do this. Perhaps not out of cron, it can instead be a long running process in a sleep/fork/exec(check_tcp)/waitpid loop.