Quote:
Originally Posted by Peterken
What are the minimum requirements to be able to make this work and just send a mail on a system without GUI? I guess:
1) finalizing your example - assume that the $hostname has to be defined
2) SMTP configuration
3) creating a cron job
|
hostname needs to be defined and mail needs some more arguments. Namely -s "the subject of the mail". Just run the example and see what mail asks for. Also check the options for ping. -t should be the time out and -c be the count. Just double check. And while your at it use some absolute path to the binaries so you don't run into trouble when using cron.
working smtp configuration check
cronjob check
Quote:
Originally Posted by Peterken
Since this doesn't work for a service, what would be the way through a script?
|
By some degree it can be done. I sometimes use telnet to see if services are alive. If it returns cryptic characters the service is a live. Also with the SSL upcome on most services telnet is lacking. Nother approach would be to use expect and parse the output of telnet.
But for checking on services i would use some of the tools metioned above. Way easier. Though the hand roll approach should be more rewarding.