- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- who command inside a script thru cron causes error...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
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
05-05-2005 05:01 AM
05-05-2005 05:01 AM
who command inside a script thru cron causes error mesg
Does anyone have any scripting ideas on how to test for the presents of a non-terminal su???
The error message being generated is following:
ttytype: couldn't open /dev/tty for reading
stty: : Not a typewriter
Not a terminal
stty: : Not a typewriter
stty: : Not a typewriter
^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2
^[2 ^[2 ^[2 ^[2 ^[2 ^[2
process not attached to terminal
Usage: who [-rbtpludAasHTqRm] [am i] [utmp_like_file]
r run level
b boot time
t time changes
p processes other than getty or users
l login processes
u useful information
d dead processes
A accounting information
a all (rbtpludA options)
s short form of who (no time since last output or pid)
H print header
T status of tty (+ writable, - not writable, x exclusive open, ? hung)
q quick who
R print host name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2005 05:04 AM
05-05-2005 05:04 AM
Re: who command inside a script thru cron causes error mesg
then
INTERACTIVE=/sbin/true
else
INTERACTIVE=/sbin/false
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2005 05:05 AM
05-05-2005 05:05 AM
Re: who command inside a script thru cron causes error mesg
if [[ -t 0 ]]
then
echo "Stdin is a terminal/tty device"
else
echo "It ain't"
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2005 10:26 AM
05-05-2005 10:26 AM
Re: who command inside a script thru cron causes error mesg
and the same is true for "who am I", so put that into the "then" part...
if [ -t 0 ]
then stty ...
tabs
who am I
fi
Oh, you'll find those statements in your "/etc/profile" (for years now, seems to be some kind of a tradition to have to fix it manually)...
FWIW,
Wodisch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2005 01:44 PM
05-05-2005 01:44 PM
Re: who command inside a script thru cron causes error mesg
tput tabs ttytype tset stty clear
and you might as well skip things like the copyright message, email check, news and /etc/motd when tty -s is false. The who command has a lot of terminal-dependent options, so you have to limit the options you use. There are a number of other commands for user details in addition to who. These are:
last -R -4 user_name
/usr/lbin/getprpw (lots of options - see man page)
logins -xol user_name
Bill Hassell, sysadmin