Operating System - HP-UX
1833294 Members
3055 Online
110051 Solutions
New Discussion

Re: Crontab schedule, why?

 
Peston Foong
Advisor

Crontab schedule, why?

Hi, All.

All of yours input would be appreciated. Thank you in advance to all of your.

I had made some schedule jobs onto the crontab. But I have a bit curious about the crontab functionality. Below are the daily schedule run on crontab:-

0 23 * * * su - sys800 c "/baan4/bse/etc/rc.startjob D1PSI1"
0 03 * * * su - sys800 -c "/baan4/bse/etc/rc.startjob D1R01"

Nothing wrong with schedule, but every time when the schedule completed. It would sent a message to root. The message is about :

ttytype: couldn't open /dev/tty for reading
stty: : Not a typewriter
stty: : Not a typewriter
(c)Copyright 1983-1997 Hewlett-Packard Co., All Rights Reserved.
You have mail.
Not a terminal
stty: : Not a typewriter
stty: : Not a typewriter

What did it meant above message?

Perhaps, the schedule must add on redirect input like "2>&1" at the behind the schedule. Then the schedule would look like this:-

0 23 * * * su - sys800 -c "/baan4/bse/etc/rc.startjob D1PSI1 2>&1"

Please help. Thank you.

Regards,
Peston Foong.
2 REPLIES 2
James R. Ferguson
Acclaimed Contributor

Re: Crontab schedule, why?

Hi Peston:

This is expected.

The messages you are seeing are a consequence of the .profile being read during the 'su'. The "not a terminal" message is from stty failing to get the terminal type -- it can't; it's not a interactive login.

One solution is to redirect stdout & stderr to /dev/null, as:

# su - sys800 -c "your_script" > /dev/null 2>&1

...JRF...

Peston Foong
Advisor

Re: Crontab schedule, why?

Hi, James R

This is the user sys800 .profile that is setting the terminal, maybe we could do something here. My instinct told me that.

# Set up the terminal:
if [ "$TERM" = "" ]
then
eval ` tset -s -Q -m ':?hp' `
else
eval ` tset -s -Q `
fi
stty erase "^H" kill "^U" intr "^C" eof "^D"
stty hupcl ixon ixoff
tabs

But, I couldn't understand the syntax that written above. For example stty hupc1 ixon ixoff. Perhap you can help. Thanks