LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Linux mail to Windows NT (https://www.linuxquestions.org/questions/linux-general-1/linux-mail-to-windows-nt-8484/)

skopje909 11-08-2001 08:40 PM

Linux mail to Windows NT
 
In Linux (RedH V6.2) is there a way I can send the message log that sits in /var/spool/mail "root" file to a Windows machine as an email? Any suggestions.....

unSpawn 11-09-2001 12:58 AM

/var/spool/mail/root is kinda like root's "unopened mail"box, so this can contain a lot of stuff, but basically it's text.

just execute "cat /var/spool/mail/root | mail -s "(subject)" address1@host2 address2@host3".

If you rather would daily send the /var/log/messages or any other logfile before it gets logrotated, you can set up a cronjob (maybe as a pre-logrotate script) to mail it.
Find the name of the logfile in /etc/logrotate.d,
open up the script, itll show
/var/log/<filename>{
lotsa options
lotsa options
lotsa options
}
just make it look like

/var/log/<filename>{
prerotate
cat /var/log/<filename> | mail -s "" address@host
endscript
lotsa options
lotsa options
lotsa options
}

ofcourse you can also do daily mailing without relying on logrotated, then just dump the mailscript in /etc/cron.daily...


HTH somehow

skopje909 11-12-2001 04:10 PM

The "cat" command works fine but I can't get it to log it daily.
The config file is /etc/logrotate.d/syslog The first couple of lines read :
/var/log/messages {
postrotate
/usr/bin/killall -HUP syslogd
endscript
}

I have changed it to :
/var/log/messages {
prerotate
cat var/log/messages | mail -s "" jadmin@myhost.com
endscript
}

Is the above correct?
Should I keep the original postrotate line and add the prerotate?
As the way I have it does not do the email

Any suggestions.....






I tried adding the following (as an example):


All times are GMT -5. The time now is 10:39 AM.