Click to See Complete Forum and Search --> : using sendmail...


airedale
04-16-2001, 04:57 PM
I currently run a game server which has a semi-permanent static IP... what I mean by that, is that it changes every once in a great while. Well anyway it happened the other day and I didn't know the new IP to my server - it is headless and a pain to hook up -- also I couldn't remote log in cause I didn't have the IP. Well anyway, I was thinking it would be cool if you could have sendmail just mail you ifconfig, say every morning at 7:00 a.m.

Well does anyone know how to do this? I really don't know sendmail all that well, but I think this could be a pretty cool use of it :)

Thanks,

Adam

emanonii
04-17-2001, 11:17 AM
Here's a script you could use (this requires sendmail to be running):

#!/bin/csh

set MAILTO = "user@domain"

set DATE = `date`

ifconfig eth0 > ip_logfile

mailx -s"ip address on $DATE" $MAILTO <ip_logfile

# end of script

You will then get a mail with with the IP address in the body of the email.

Give the script 777 permissions so it is executeable and then add the script to cron. Your entry should look like:

0 7 * * * path_and_name_of_script

good luck!

airedale
04-18-2001, 03:33 AM
I set that up, and it sort of works if I replace the mailx, with sendmail. I don't exactly know how to set up sendmail, but I think all I need to really specify is the smtp server, but I don't know where to specify that.
Do you know?

Thanks,

Adam

emanonii
04-18-2001, 11:51 AM
I think it goes into sendmail.cf (I think it is in /etc).

Webby
04-18-2001, 06:34 PM
as far as i can figure out, snedmail calls your smtp server a 'smart relay host'. go into /etc/sendmail.cf and look for this in the comments. the line the comment refers to starts with a DS i think.

Alex

airedale
04-18-2001, 09:56 PM
I just tried putting that in there, and I restarted sendmail and it failed... the error that popped up was:

unknown configuration line "my.mail.server.here"

should I put something in front of it?

If you want to see the server config file before I edited it, go here (http://131.156.174.46/~airedale/sendmail.cf)

bdg1983
04-19-2001, 05:59 AM
On our work AIX servers, we use DSesmtp:domainname.com and also DResmtp:domainname.com where domainname would be your smtp server.