- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Cannot send mail in crontab
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2007 05:19 AM
09-18-2007 05:19 AM
Cannot send mail in crontab
In command line I send mail do internet addresses but when i put the same command in crontab it doesn’t work.
Can anybody tell me why?
It is HP-UX 11.23
the content of the script testemailx is:
su - username -c "/usr/bin/rm /tmp/obj_create.out; sqlplus '/as sysdba' @ /cron_scripts/obj_create.sql;"
/usr/bin/mailx -s "TestMailx " name@somewhere.com < /tmp/obj_create.out
the line in crontab:
* * * * * /tmp/testemailx > /tmp/testemailx.out 2>/tmp/testemailx.err
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2007 05:40 AM
09-18-2007 05:40 AM
Re: Cannot send mail in crontab
Try adding any obvious envirnmental variables to the script as well as full paths to any command you are using.
Regards,
-dl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2007 01:44 PM
09-18-2007 01:44 PM
Re: Cannot send mail in crontab
You seem to have absolute paths for everything except sqlplus.
Do you have read permission on /tmp/obj_create.out, created by a different user?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2007 10:27 PM
09-18-2007 10:27 PM
Re: Cannot send mail in crontab
I make in the script env > /tmp/testeMailxEnv and the result is the same as my user env, except for the following variables:
MANPATH, COLUMNS, EDITOR, HISTFILE, ERASE, PS1, TERM, LINES
I don't think this will be important...
for the output of /tmp/testemailx.err is
ttytype: couldn't open /dev/tty for reading
stty: : Not a typewriter
Not a terminal
stty: : Not a typewriter
stty: : Not a typewriter
Yes I have permissions for /tmp/obj_create.out
I also tried with sendmail comand in the script but the result was the same, no mail was send.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2007 10:54 PM
09-18-2007 10:54 PM
Re: Cannot send mail in crontab
>I don't think this will be important...
It doesn't seem like it.
>for the output of /tmp/testemailx.err is
ttytype: couldn't open /dev/tty for reading
stty: : Not a typewriter
You need to clean up your .profile and /etc/profile to not execute stty and ttytype if you are not interactive. You can guard it by either:
if [ "${-%%*i*}" != "$-" ]; then
if tty -s; then
>I also tried with sendmail comand in the script
If you can echo something after sendmail, then it would show the issue with the mail system and not cron.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2007 12:48 AM
09-19-2007 12:48 AM
Re: Cannot send mail in crontab
username@somewhere.com... Connecting to proxymail.domain.com via relay...
220 proxyserver.domain.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.1830 ready at Wed, 19 Sep 2007 11:58:53 +0100
>>> EHLO server.domain.com
250-proxyserver.domain.com Hello [110.111.134.140]
250-AUTH GSSAPI NTLM
250-TURN
250-SIZE 15728640
250-ETRN
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-8bitmime
250-BINARYMIME
250-CHUNKING
250-VRFY
250 OK
>>> MAIL From:
250 2.1.0 root@server.domain.com....Sender OK
>>> RCPT To:
250 2.1.5 username@somewhere.com
>>> DATA
354 Start mail input; end with
>>> .
250 2.6.0 <200709191100.l8JB00a11727@server.domain.com> Queued mail for delivery
username@somewhere.com... Sent ( <200709191100.l8JB00a11727@server.domain.com> Queued mail for delivery)
Closing connection to proxymail.domain.com
>>> QUIT
221 2.0.0 proxyserver.domain.com Service closing transmission channel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2007 04:13 AM
09-19-2007 04:13 AM
Re: Cannot send mail in crontab
The output of sendemail helped.
I edit the /etc/mail/sendmail.cf
where is was
# class E: names that should be exposed as from this host, even if we masquerade
CE root
I change to
CE
where it was
# class L: names that should be delivered locally, even if DH is set
CL root
I change to
CL
Thanks for the input.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2007 04:33 AM
09-19-2007 04:33 AM