The not-a-typewriter error is caused by running commands where there is no controlling tty device; that is, no interactive terminal is present. This would be true for a script that runs in cron or has su - to run a batch job.
To prevent this, you need to start with /etc/profile and test for an interactive tty device as in:
While this may seem cryptic, the shell understands whether it is interactive or not and sets a flag (the i flag). The construct $- returns all the current flags that are set as a string and if the letter i appears in the string, the shell is interactive. Another way is to test the terminal device with the tty(1) command as in:
The choice of $TTY or $INTERACTIVE is arbitrary as far as names. In your /etc/profile (and .profile, etc.), you can then test for interactive terminal prior to any settings that affect the terminal. A few of the common commands are: stty, tput, and tabs. Here is an example:
Hello gurus,
I am making what I think is a simple db2 call from within a shell script but I am having difficulty producing the desired
report when I run the script shown below from a shell script in cron. For example, my script and the crontab file setup
is shown below:
#!/bin/ksh
db2... (3 Replies)
Hi Team,
When i am running the below query manually it is giving me the right output
i.e.
export PATH=/usr/sbin:/usr/bin:/sbin:/bin:$PATH
ADMIN=abc@abc.com
CPU_HIGH=`sar|awk '{print $9}'|sort -n|head -5|sed -n 5p`
CPU_MAX=`echo "scale=3; 100-$CPU_HIGH" | bc`
CPU_LOW=`sar|awk '{print... (13 Replies)
Hi I am running the following script in cron tab:
#!/usr/local/bin/php
<?php
$handle=fopen('xmlfile.xml',"w");
$xmlfile= file_get_contents('http://diur-plus.2me.co.il/xml.aspx');
fwrite($handle,$xmlfile);
fclose($handle);
/*
* To change this template, choose Tools |... (1 Reply)
Hi all,
I am brand new in linux and not sure where to post this i posted it also on debian but i think this place would have been better. I have a cron log error which i am trying to locate if anyone has any ideas that would be really appreciated
################### Logwatch 7.3.6... (3 Replies)
Hi all,
I am brand new in linux and i have a cron lon error which i am trying to locate if anyone has any ideas that would be really appreciated
################### Logwatch 7.3.6 (05/19/07) ####################
Processing Initiated: Thu Nov 10 06:25:26 2011
Date Range... (0 Replies)
Hi,
The following shell script runs without any problem when executed manulally.
USED=$(df -h /arch | tail -1 | awk '{print $5}' | cut -d '%' -f 1)
if
then
find /arch/AUBUAT/ -type f -mtime +0 | xargs rm
find /arch/AUBMIG/ -type f -mtime +0 | xargs rm
fi
But the same gives below... (6 Replies)
Good morning. I am searching for "how-to"'s for some particular questions:
1. How to write a script in HP-UX 11.
2. How to schedule a script.
3. How to "call" scripts from the original script.
4. How to su to another user from within a script.
This is the basics of what the... (15 Replies)
Hi Everyone,
I have written a korn shell script to shutdown my documentum docbase server and to restart it automatically on a weekly basis. My script is,
When i execute this script manually, i was able to execute it successfully without any issues. I have scheduled this script in cronjob... (1 Reply)
I am using the following cron entry to run a cron job every 4 hours and
it is rejecting it:
0 */4 * * * /home/location/scriptname
When I put this entry in cron is errors with: 0481-079 reached a symbol that is not expected.
This is an AIX 5.3 system
Any ideas?
Thanks (4 Replies)