Re: [aclug-L] shell script
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Fri, Nov 20, 1998 at 01:17:45PM -0600, Jesse Kaufman wrote:
> > ping some host once "ping -c 1 "
Incidentally, this should not be 1, since normal packet loss could cause one
packet to be dropped, and this would not necessarily be indicitive of any
unusual behavior. Perhaps 5 or so would be a good value, and if none come
back, then there is a problem.
> ok, it may not be the most efficient (i dunno), but C++ would be my
> progamming language of choice, since it's the only one listed that i am
> currently taking at Tabor... how do i go about sending the message to the
> person? now that the ping part is (getting) figured out, that's my main
> question... how to send the e-mail...
The secret is popen. Use it like this:
FILE *mail;
mail = popen("/usr/sbin/sendmail -t", "w");
/* check that mail is not null! */
/* Now, send headers... */
fprintf(mail, "To: recipient@xxxxxxxxxxxxx\n");
fprintf(mail, "Subject: Something's crashed again\n");
/* Send a blank line to signify end of headers. */
fprintf(mail, "\n");
/* Send the body of the message. */
fprintf(mail, "I can't ping that machine.\n");
/* Send it off. */
fclose(mail);
>
>
> --
> +============================+============================+
> ! Tabor College ! ICQ UIN1: 4022791 !
> ! 400 S. Jefferson ! ICQ UIN2: 13115282 !
> ! Hillsboro, KS 67063 ! kaufmjes@xxxxxxxxxxxxxxxxx !
> +============================+============================+
>
>
>
> ---
> This is the Air Capitol Linux Users Group discussion list. If you
> want to unsubscribe, send the word "unsubscribe" to
> aclug-L-request@xxxxxxxxxxxx. If you want to post to the list, send your
> message to aclug-L@xxxxxxxxxxxx.
--
John Goerzen Linux, Unix consulting & programming jgoerzen@xxxxxxxxxxxx |
Developer, Debian GNU/Linux (Free powerful OS upgrade) www.debian.org |
----------------------------------------------------------------------------+
Visit the Air Capital Linux Users Group on the web at http://www.aclug.org
---
This is the Air Capitol Linux Users Group discussion list. If you
want to unsubscribe, send the word "unsubscribe" to
aclug-L-request@xxxxxxxxxxxx. If you want to post to the list, send your
message to aclug-L@xxxxxxxxxxxx.
|
|