Operating System - HP-UX
1748252 Members
3923 Online
108760 Solutions
New Discussion юеВ

Re: mailx doesn't works with crontab

 
SOLVED
Go to solution
Davide Depaoli
Occasional Advisor

mailx doesn't works with crontab

I need to use mailx in crontab to send messages to Exchange users and it doesn't works.
My command is:
mailx -s "SUBJECT" email_user_address < text_file

If use it in a hand running shell script or as command line it works. Scheduled in crontab doesn't, and in /var/adm/cron/log there is the entry:
CMD: mailx -s "TEST" depaolid@edison.it < test.msg

Any idea ?
Thanks in advance
Regards Davide
10 REPLIES 10
Stefan Farrelly
Honored Contributor

Re: mailx doesn't works with crontab


I treid it around the other way;

cat text_file | mailx -s "test" root

and it worked fine in cron.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Stefan Farrelly
Honored Contributor

Re: mailx doesn't works with crontab


I tried it around the other way;

cat text_file | mailx -s "test" root

and it worked fine in cron.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Stefan Farrelly
Honored Contributor

Re: mailx doesn't works with crontab

I tried it around the other way;

cat text_file | mailx -s "test" root

and it worked fine in cron.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Stefan Farrelly
Honored Contributor

Re: mailx doesn't works with crontab

I tried it around the other way;

cat text_file | mailx -s "test" root

and it worked fine in cron.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Stefan Farrelly
Honored Contributor
Solution

Re: mailx doesn't works with crontab

I tried it around the other way;

cat text_file | mailx -s "test" root

and it worked fine in cron.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Christian Haug
Advisor

Re: mailx doesn't works with crontab

Perhaps cron doesn't find the mailx programm because it doesn't know the path. So try it with:
/usr/bin/mailx -s ....
Stefan Farrelly
Honored Contributor

Re: mailx doesn't works with crontab

oops, sorry for the multiple replies, ive been getting page errors when trying to sbmit it.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Davide Depaoli
Occasional Advisor

Re: mailx doesn't works with crontab

Thanks to Stefan.
Now it works.

Regards,
Davide
Gene Matthews
New Member

Re: mailx doesn't works with crontab

The only thing I could suggest is to put the full path for mailx (i.e. /usr/bin/mailx). I use mailx in my crontab with the full path and it works for me.