stty: tcgetattr: A specified file does not support the ioctl system call

Hi Gurus,

I have scheduled a script using cron scheduler. Script works fine when i run it manually. But it gives the following error in cron log.

stty: tcgetattr: A specified file does not support the ioctl system call.

I have given the following statement in cron.

0-59 * * * * /info/test/Scripts/check_num_proc.sh >> /tmp/check_num_proc_cron.log 2>&1

Please let me know what could be the problem.

Sam

The problem is in here:
/info/test/Scripts/check_num_proc.sh

It does not have a controlling terminal, i.e., no /dev/tty, when it is run in cron.
If you do a stty coomand it will break, for example.

You can usually get around this with something like this.

if [  -f /dev/tty ] ; then
   # play with terminal settings here
fi

I had this issue too. I'm guessing you run stty in the background. Try:

stty ... 2>/dev/null

Thanks Jim.

I have removed the following statement from my .profile. The issue seems to be fixed now.

stty erase ^?

But is there a workaround for this. Without the above statement in .profile, It is annoying to use keys (shift +backspace) every time i type something wrong.

Regards

I gave you the workaround - issue an stty inside an if statement that tests for the existence of /dev/tty. put that code in .profile

Thanks Jim. will try that.

Regards