- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: cron email message failure
Categories
Company
Local Language
Forums
Discussions
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Knowledge Base
Forums
Discussions
- Cloud Mentoring and Education
- Software - General
- HPE OneView
- HPE Ezmeral Software platform
- HPE OpsRamp
Knowledge Base
Discussions
Forums
Discussions
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
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-23-2004 07:54 AM
09-23-2004 07:54 AM
cron email message failure
I was attempting to clean-up cron generated email messages. I was receiving the "stty::Not a typewriter" message. We don't have a terminal attached. I found the following code to eliminate the messages, but I've discovered that I can no longer receive any messages from the system. I ran the same script that worked before I modified the /etc/profile file and I can't receive the email message. The code I added to the /etc/profile file is as follows:
==begin
tty > /dev/null
rc=$?
if [ $rc -eq 0 ]
then
stty erase "^H" kill "^U" intr "^C" eof "^D" susp "^Z"
[[ $TERM = vt220 ]] && stty erase "^?"
[[ $TERM = vt200 ]] && stty erase "^?"
stty hupcl ixon ixoff
tabs
fi
==end
I put the original /etc/profile file back, but still can't receive email. Any ideas?
Thanks,
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2004 08:09 AM
09-23-2004 08:09 AM
Re: cron email message failure
not from /etc/profile
not from .profile
set up the TERM variable in the job and it will stop with the typewriter message.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2004 08:25 AM
09-23-2004 08:25 AM
Re: cron email message failure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2004 08:39 AM
09-23-2004 08:39 AM
Re: cron email message failure
A better way to check if the process is attached to a terminal or not is to check for the existence of the filedes 1 (i.e stdout)
if [ -t 1 ]
then
stty erase "^H" kill "^U" intr "^C" eof "^D" susp "^Z"
[[ $TERM = vt220 ]] && stty erase "^?"
[[ $TERM = vt200 ]] && stty erase "^?"
stty hupcl ixon ixoff
tabs
else
# Not attached to a terminal
# Skip the stty commands
:
fi
You donâ t need an else section in there, but I added just to demonstrate.
But as noted above, cron jobs donâ t use /etc/profile or any of the login initialization files unless otherwise referred explicitly (like if your job executes su - or sources . /etc/profile with in the script).
- Sun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2004 12:50 PM
09-23-2004 12:50 PM
Re: cron email message failure
Unless, the script has a . /etc/profile at the top.
Thats probably a bad idea but could set up a scanario under which /etc/profile does effect script behavior.
Also the /usr/bin/su - usernamne -c
Seems there may be something wrong with the sendmail setup.
try this:
sendmail -v -d8.99 -d38.99 someone@your.net
type some text
.
This will get you great diagnositcs and point to any sendmail configuration errors or eliminate that as a possibility.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2004 06:53 PM
09-23-2004 06:53 PM
Re: cron email message failure
tty
ttytype
tset
stty
tabs
tput
One way to handle this is to put all the terminal-specific code in a seperate file, things like setting DISPLAY. You can then use one several interactive terminal tests to run the script:
if echo $- | grep i
...
if [ -t 1 ]
...
If tty -s
...
Note that setting TERM=vt220 is not a good idea as it forces terminal-aware code to output only one set of strings. The correct way is to set the terminal using ttytype:
eval $(ttytype -s)
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2004 11:44 PM
09-23-2004 11:44 PM
Re: cron email message failure
This thread in which some of the guys here have replied has good assistance.
Hope it helps
Prashant