Sponsored Content
Top Forums Shell Programming and Scripting stty error when script is called out of a cronjob Post 302401246 by fabiogilr on Friday 5th of March 2010 09:17:21 AM
Old 03-05-2010
stty error when script is called out of a cronjob

Hello,



I'm trying to implement a script to call a third-party tool every so often and write the results to a file. If I run it interactively it works fine, but when it comes to run it out of a cronjob, I keep getting this error:

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


I need to call stty cols 132 so that the third-party tool works at all, otherwise I'd get: "display area must be at least 10 rows and 80 columns press <ctrl-d> to exit" written to my log file.

I have googled the error and people advise that cron does not have a terminal

Any suggestion on how to get the information out?

Here's the code

Code:
echo $dateout': Running spsmon now...' > $logfile
stty cols 132
spsmon -state Working > $tmpfile &
echo "PID of job put in backround = $!"
sleep 5
kill -9 $!
cat $tmpfile | awk 'BEGIN{RS=";";ORS="\n"} {print}' | awk '/Working/' | cut -c3-130 >> $logfile

Thanks Much
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

stty erase in a script

does anyone know how to incorporate this in a script so users can actually make use of their backspace button that they've grown accustomed to? stty erase ^H --- this isn't working the script. works on command line but i wanna invoke it whenever this program of mine is run so users can use... (2 Replies)
Discussion started by: Terrible
2 Replies

2. UNIX for Dummies Questions & Answers

expect and stty paths are different and resulting in error.

Hello, i am using expect to automate file transfers to and fro with a sftp server. below is the script i am creating and executing in the main program. but i am getting the following error: the main program that creates and runs this script looks for words like "not found" in... (6 Replies)
Discussion started by: The Nemi
6 Replies

3. UNIX for Advanced & Expert Users

stty: error occurs when installing rpm

Hello All, when I install rpm rpm --install rpm packagename I got the following errors stty:standard input:invalid argument stty:standard input:invalid argument I dont know what i have to do exactly. I search on google for the same but not a particular standard solution is given... (17 Replies)
Discussion started by: amitpansuria
17 Replies

4. Shell Programming and Scripting

cronjob: Partial script error

Part of my script throws an error. Your "cron" job on mitv-t-voms02 /usr/tlrscr/runhc.sh produced the following output: /usr/tlrscr/runhc.sh: top: not found /usr/tlrscr/runhc.sh: top: not found /usr/tlrscr/runhc.sh: top: not found syntax error on line 1, teletype That part of... (2 Replies)
Discussion started by: sundar63
2 Replies

5. UNIX for Dummies Questions & Answers

stty: : Not a typewriter with AUTOSYS error

(sys10:pt:/pf>) cat 122974qqq.s RUNAS Version 2007.10.07 Run on Dec 11 2008 10:09:36 AM UNIX Process: 26021 Login User : root PFW User : s08280 Not a terminal stty: : Not a typewriter stty: : Not a typewriter ksh: jil: not found ksh: sendevent: not found... (1 Reply)
Discussion started by: arunkumar_mca
1 Replies

6. Shell Programming and Scripting

Perl script with rsh gets stty invalid message

I have a Perl script, that does a system call with rsh to a remote machine. #!/usr/bin/env perl system ("rsh remote-machine echo 99"); And I get the following: stty: standard input: Invalid argument 99 I've tried replacing the system call with below, but I still get the same stty... (1 Reply)
Discussion started by: slchin
1 Replies

7. Shell Programming and Scripting

A running Script giving error while scheduled in cronjob

Hi, I have script which is properly running but when i schedule it in cron it throws an error like : Your "cron" job on retrprdapp1 /usr/bin/sh /retr/cron/ftp.sh 2>&1 produced the following output: /retr/cron/ftp.sh: syntax error at line 17: `(' unexpected line17 is # Get list of... (10 Replies)
Discussion started by: rajagasti
10 Replies

8. Shell Programming and Scripting

stty: : I/O Error

Hi all, I am stuck on a shell script issue and need your inputs: I have a parent script A.ksh which call in another script B.ksh. At the start of the B.ksh, we export the .profile of another user and then call Informatica jobs. Issue When I run my jobs from the command prompt, it works... (1 Reply)
Discussion started by: fromrishi
1 Replies

9. Shell Programming and Scripting

Use of stty vs trap in script-driven login menu

My employers would like me to selectively run one of several different (already-existing) Korn Shell menu-driven scripts out of the user's .profile file, depending on some yet-to-be-specified user critieria. I've never done this kind of thing, but I have the existing scripts (among other... (5 Replies)
Discussion started by: Clovis_Sangrail
5 Replies

10. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies
profile(4)						     Kernel Interfaces Manual							profile(4)

NAME
profile - set up user's environment at login time DESCRIPTION
If the file exists, it is executed by the shell for every user who logs in. The file should be set up to do only those things that are desirable for every user on the system, or to set reasonable defaults. If a user's login (home) directory contains a file named that file is executed (via the shell's before the session begins. files are useful for setting various environment parameters, setting terminal modes, or overriding some or all of the results of executing EXAMPLES
The following example is typical (except for the comments): # Make some environment variables global export MAIL PATH TERM # Set file creation mask umask 22 # Tell me when new mail comes in MAIL=/var/mail/myname # Add my /bin directory to the shell search sequence PATH=$PATH:$HOME/bin # Set terminal type echo "terminal: c" read TERM case $TERM in 300) stty cr2 nl0 tabs; tabs;; 300s) stty cr2 nl0 tabs; tabs;; 450) stty cr2 nl0 tabs; tabs;; hp) stty cr0 nl0 tabs; tabs;; 745|735) stty cr1 nl] -tabs; TERM=745;; 43) stty cr1 nl0 -tabs;; *) echo "$TERM unknown";; esac A more complete model can be found in FILES
SEE ALSO
env(1), login(1), mail(1), sh(1), stty(1), su(1), environ(5), term(5). profile(4)
All times are GMT -4. The time now is 03:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy