1827708 Members
2602 Online
109967 Solutions
New Discussion

Re: Cron for sendmail

 
SOLVED
Go to solution
Abhijeet_3
Frequent Advisor

Cron for sendmail

I have sendmail configured on my server.

I need to send a message using mail every Friday afternoon to some users ,

What should be the correct syntax/command for email.

Thanks

Abhijeet
7 REPLIES 7
Thierry Poels_1
Honored Contributor
Solution

Re: Cron for sendmail

hi,

crontab:
30 14 * * 5 /usr/bin/mail -s "it's Friday" user1@xx user2@xx < /mydir/mymessage.txt

regards,
Thierry;



All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Abhijeet_3
Frequent Advisor

Re: Cron for sendmail

Thanks Thierry,

I have a issue , the mail command is not in /usr/bin , it is in /bin. It has a permission 755.

When I use /bin/mail -s " Subject" user1@mydomain.com , it gives me permission error. ( /usr/sbin/sendmail)

This is a linux server.

Abhijeet
Vitaly Karasik_1
Honored Contributor

Re: Cron for sendmail

I afraid you havewrong permissions on some mail directories [var/spool/mail?].

which linux distro do you use?
Thierry Poels_1
Honored Contributor

Re: Cron for sendmail

ooops, sorry about the "/usr/bin". Just revealed my HPUX roots ;)

Tested it on Red Hat Linux:
/bin/mail -s "subj" user@comp.com < /tmp/message

which error do you exactly get?

regards,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Thierry Poels_1
Honored Contributor

Re: Cron for sendmail

BTW /usr/bin/sendmail should be -r-sr-xr-x
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Steven E. Protter
Exalted Contributor

Re: Cron for sendmail

You can adjust the cron entry to where sendmail actually is.

/usr/sbin/sendmail

Or for hard core HP-UX people, you can set up a soft link

ln -s /usr/sbin/sendmail /usr/bin/mail

As far as permissions go:

chmod a+x /usr/sbin/sendmail

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Vitaly Karasik_1
Honored Contributor

Re: Cron for sendmail

dear all,

there are many tricks with mail & sendmail permissions in different unix's [they trying to increase security, of course].

So I asked which distro Abhijeet uses. For example, in RH linux sendmail has g+s bit.