darlingm2
asked on
Problem with piping email into script on CentOS using /etc/aliases or .forward
I need to use this functionality tomorrow, and am still having issues with it. </panic> </slapForehead> Any assistance would be much appreciated.
I added to /etc/aliases:
tp: "|/raid/home/mdarling/code /sms/sms > /raid/host/toadprinceillus trations.c om/logs/tp .log 2>&1"
And, of course, ran newaliases after to regenerate aliases.db.
If I run "mail tp", with test as subject/body, it's like the email goes nowhere.
To try to diagnose the problem down, I:
* Recompiled the c plus plus (experts exchange wont let me use plus signs here for some reason) program sms so the only instruction is "cout << 10 / 0;", which when ran adds a line to dmesg like: "sms[12602] trap divide error . . ." to I can easily see if the program executes, without the possibility of a bug in my program causing it to appear like the email isn't going anywhere. If I "mail tp", a divide error isn't added to dmesg. (I've also tried the program as originally made without the divide by zero instruction -- which works correctly when executed normally not through an email pipe -- and it doesn't seem to execute either, just in case dmesg wouldn't log a divide by zero error for some reason through an email pipe.)
* Made sure there aren't any conflicting entries in /etc/mail/virtusertable, and ran make in that directory to regenerate virtusertable.db.
* Removed the tp line in /etc/aliases, and mailed tp. The email properly arrived in /etc/mail/tp, so I know there isn't a general configuration issue with the account or sendmail in general.
* Removed the tp line in /etc/aliases, and created ~tp/.forward with:
"|/raid/home/mdarling/code /sms/sms > /raid/host/toadprinceillus trations.c om/logs/tp .log 2>&1"
which I'm not sure should work, but I saw some references to using .forward instead of /etc/aliases to pipe email. Had no effect here either.
I haven't changed any of the file permissions or ownerships, but ownershio/permission-check s so you can see them are:
[root@servo mail]# ls -la /etc/aliases* /etc/mail/* ~mdarling/code/smsCreditCa rd/smsCred itCard ~tp/.forward
-rw-r--r-- 1 root root 1685 May 14 10:29 /etc/aliases
-rw-r----- 1 root smmsp 12288 May 14 10:17 /etc/aliases.db
-rw-r--r-- 1 root root 595 Apr 21 23:42 /etc/mail/access
-rw-r----- 1 root root 12288 Apr 22 16:00 /etc/mail/access.db
-rw-r--r-- 1 root root 0 Mar 14 2007 /etc/mail/domaintable
-rw-r----- 1 root root 12288 May 17 2008 /etc/mail/domaintable.db
-rw-r--r-- 1 root root 5521 Mar 14 2007 /etc/mail/helpfile
-rw-r--r-- 1 root root 243 Apr 21 23:45 /etc/mail/local-host-names
-rw-r--r-- 1 root root 64 Mar 14 2007 /etc/mail/local-host-names .sample
-rw-r--r-- 1 root root 0 Mar 14 2007 /etc/mail/mailertable
-rw-r----- 1 root root 12288 May 17 2008 /etc/mail/mailertable.db
-rw-r--r-- 1 root root 1048 Mar 14 2007 /etc/mail/Makefile
-rw-r--r-- 1 root root 58195 May 20 2008 /etc/mail/sendmail.cf
-rw-r--r-- 1 root root 58194 May 17 2008 /etc/mail/sendmail.cf.samp le
-rw-r--r-- 1 root root 7209 Mar 14 2007 /etc/mail/sendmail.mc
-r--r--r-- 1 root root 41275 Mar 14 2007 /etc/mail/submit.cf
-rw-r--r-- 1 root root 940 Mar 14 2007 /etc/mail/submit.mc
-rw-r--r-- 1 root root 127 Mar 14 2007 /etc/mail/trusted-users
-rw-r--r-- 1 root root 851 May 14 10:10 /etc/mail/virtusertable
-rw-r--r-- 1 root root 2204 May 20 2008 /etc/mail/virtusertable.ba ckup
-rw-r--r-- 1 root root 1044 May 14 10:10 /etc/mail/virtusertable.ba k
-rw-r----- 1 root root 12288 May 14 10:10 /etc/mail/virtusertable.db
-rwxrwxr-x 1 mdarling mdarling 2597264 May 14 10:01 /raid/home/mdarling/code/s ms/smsCred it
-rw-r--r-- 1 tp tp 56 May 14 09:57 /raid/host/toadprinceillus trations.c om/users/t p/.forward
I added to /etc/aliases:
tp: "|/raid/home/mdarling/code
And, of course, ran newaliases after to regenerate aliases.db.
If I run "mail tp", with test as subject/body, it's like the email goes nowhere.
To try to diagnose the problem down, I:
* Recompiled the c plus plus (experts exchange wont let me use plus signs here for some reason) program sms so the only instruction is "cout << 10 / 0;", which when ran adds a line to dmesg like: "sms[12602] trap divide error . . ." to I can easily see if the program executes, without the possibility of a bug in my program causing it to appear like the email isn't going anywhere. If I "mail tp", a divide error isn't added to dmesg. (I've also tried the program as originally made without the divide by zero instruction -- which works correctly when executed normally not through an email pipe -- and it doesn't seem to execute either, just in case dmesg wouldn't log a divide by zero error for some reason through an email pipe.)
* Made sure there aren't any conflicting entries in /etc/mail/virtusertable, and ran make in that directory to regenerate virtusertable.db.
* Removed the tp line in /etc/aliases, and mailed tp. The email properly arrived in /etc/mail/tp, so I know there isn't a general configuration issue with the account or sendmail in general.
* Removed the tp line in /etc/aliases, and created ~tp/.forward with:
"|/raid/home/mdarling/code
which I'm not sure should work, but I saw some references to using .forward instead of /etc/aliases to pipe email. Had no effect here either.
I haven't changed any of the file permissions or ownerships, but ownershio/permission-check
[root@servo mail]# ls -la /etc/aliases* /etc/mail/* ~mdarling/code/smsCreditCa
-rw-r--r-- 1 root root 1685 May 14 10:29 /etc/aliases
-rw-r----- 1 root smmsp 12288 May 14 10:17 /etc/aliases.db
-rw-r--r-- 1 root root 595 Apr 21 23:42 /etc/mail/access
-rw-r----- 1 root root 12288 Apr 22 16:00 /etc/mail/access.db
-rw-r--r-- 1 root root 0 Mar 14 2007 /etc/mail/domaintable
-rw-r----- 1 root root 12288 May 17 2008 /etc/mail/domaintable.db
-rw-r--r-- 1 root root 5521 Mar 14 2007 /etc/mail/helpfile
-rw-r--r-- 1 root root 243 Apr 21 23:45 /etc/mail/local-host-names
-rw-r--r-- 1 root root 64 Mar 14 2007 /etc/mail/local-host-names
-rw-r--r-- 1 root root 0 Mar 14 2007 /etc/mail/mailertable
-rw-r----- 1 root root 12288 May 17 2008 /etc/mail/mailertable.db
-rw-r--r-- 1 root root 1048 Mar 14 2007 /etc/mail/Makefile
-rw-r--r-- 1 root root 58195 May 20 2008 /etc/mail/sendmail.cf
-rw-r--r-- 1 root root 58194 May 17 2008 /etc/mail/sendmail.cf.samp
-rw-r--r-- 1 root root 7209 Mar 14 2007 /etc/mail/sendmail.mc
-r--r--r-- 1 root root 41275 Mar 14 2007 /etc/mail/submit.cf
-rw-r--r-- 1 root root 940 Mar 14 2007 /etc/mail/submit.mc
-rw-r--r-- 1 root root 127 Mar 14 2007 /etc/mail/trusted-users
-rw-r--r-- 1 root root 851 May 14 10:10 /etc/mail/virtusertable
-rw-r--r-- 1 root root 2204 May 20 2008 /etc/mail/virtusertable.ba
-rw-r--r-- 1 root root 1044 May 14 10:10 /etc/mail/virtusertable.ba
-rw-r----- 1 root root 12288 May 14 10:10 /etc/mail/virtusertable.db
-rwxrwxr-x 1 mdarling mdarling 2597264 May 14 10:01 /raid/home/mdarling/code/s
-rw-r--r-- 1 tp tp 56 May 14 09:57 /raid/host/toadprinceillus
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER