Operating System - HP-UX
1833730 Members
2470 Online
110063 Solutions
New Discussion

Funky "From" heading in email, when run thru crontab

 
SOLVED
Go to solution
Ratzie
Super Advisor

Funky "From" heading in email, when run thru crontab

I have a script that emails me when there is a problem, every thing works fine, but it gives a funky from.

I run this script thru root's crontab, that does ...
00 07 * * 6 su user1 -c /home/user1/scripts/backup/transfer_file.sh

I use mailx, so I can send an a attachment.

When I get the email, in the from heading
SCP id for transfer of DB

Yes, I am running a command that scp's a file, in the transfer_file.sh

Where does it pick up this wonky wording...
SCP id for transfer of DB
5 REPLIES 5
Tony Contratto
Respected Contributor
Solution

Re: Funky "From" heading in email, when run thru crontab

Hi,

My guess would be that it is coming from the comment field for the user in /etc/passwd.

-Tony
got root?
Ratzie
Super Advisor

Re: Funky "From" heading in email, when run thru crontab

You are right, but does it have to read the comments field in the passwd file?
RAC_1
Honored Contributor

Re: Funky "From" heading in email, when run thru crontab

Post scipt please.

Also what is the user1 entry in /etc/passwd? Particularly Description field.

Anil
There is no substitute to HARDWORK
Sanjay_6
Honored Contributor

Re: Funky "From" heading in email, when run thru crontab

Hi,

Though you are running this as part of root cron job, you are doing a su as user1, so effectively the user running the job is user1.

While emailing the name of the user1 specified in the /etc/passwd file is added and the from would show as

some_name

Login as root, do a su - user1 and now send yourself an email and you'll know.

Hope this helps.

Regds
RAC_1
Honored Contributor

Re: Funky "From" heading in email, when run thru crontab

Yes it reads the password file.

In your script try as follows.

mailx -r "xxx" -s "whatever" mail_id

Now it should say mail from
xxx@hostname

Anil
There is no substitute to HARDWORK