Operating System - HP-UX
1833356 Members
2840 Online
110051 Solutions
New Discussion

How to send mail to the user running at jobs

 
SOLVED
Go to solution
Aji Thomas
Regular Advisor

How to send mail to the user running at jobs

Hi guys,

I recently made a backup scripts that is scheduled daily at 8:30. The issue is that within the backup script I have redirected all the output to an file, so that i can log all the relevant information.
But now I have a backuplog file and I need to send this output as mail to the user initiating the at job command

Please advice me.
AJI
5 REPLIES 5
Thayanidhi
Honored Contributor
Solution

Re: How to send mail to the user running at jobs

cat | sendmail user@domain.com
Attitude (not aptitude) determines altitude.
Thayanidhi
Honored Contributor

Re: How to send mail to the user running at jobs

Instead redirection (>) use pipe (|) to "sendmail user@domain".

Regds
TT
Attitude (not aptitude) determines altitude.
Matthew_50
Valued Contributor

Re: How to send mail to the user running at jobs

include this line at the end of your backup script.

mailx -s "BACKUP LOG" who@somewhere.com < ./backup.log
Aji Thomas
Regular Advisor

Re: How to send mail to the user running at jobs

hi guys,

While trying to send mails it gives warnings,
$ mailx -s "test" user@domain.com
sh: domain.com: not found.

Please help me
AJi
Muthukumar_5
Honored Contributor

Re: How to send mail to the user running at jobs

The problem is hostname resolvation.

You have to try if the user is in local machine as,

mailx -s "hi" test@localhost

where, test is user name. localhost entry has to be in /etc/hosts file.

If you want to sent mail in the domain then,

--- /etc/nsswitch.conf --

hosts: files dns

--- /etc/resolve.con --

domain: aji.com
nameserver: xx.xx.xx.xx

Check the resolvation as,

nslookup .aji.com

Try as,

sendmail -v @.com
hi
bye
ctrl+d

hth.



Easy to suggest when don't know about the problem!