- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: /etc/profile Specify a parameter with this c...
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
Discussions
Discussions
Forums
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
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
тАО09-14-2006 01:45 AM
тАО09-14-2006 01:45 AM
su - sybase -c "/path/to/script_name"
thru a cron job we get this error. How can I not get this error?
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
/etc/profile[45]: test: Specify a parameter with this command.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2006 01:49 AM
тАО09-14-2006 01:49 AM
Re: /etc/profile Specify a parameter with this command
If it is syabse then allow sybase to run by adding into cron.allow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2006 01:50 AM
тАО09-14-2006 01:50 AM
Re: /etc/profile Specify a parameter with this command
if you running through cron, you don't have a terminal attached to the process.
So your who command will not work, if you are looking for session information. If the result of the who command is undefined, your test in line 45 will have nothing to compare.
Change your /etc/profile to check wether you are running from termianl or cron.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2006 01:54 AM
тАО09-14-2006 01:54 AM
SolutionAll commands having to do with an interactive tty should be encased in an
if [ -t 0 ]; then
... # interactive
else
... # not interactive
fi
block.
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2006 01:58 AM
тАО09-14-2006 01:58 AM
Re: /etc/profile Specify a parameter with this command
Launching a job by cron means batch mode, /etc/profile tests your terminal... there is no easy way to bypass, the best would be if you need the env setting of sybase to recuperate what you need in a lets say profile.sybase, put this in your /path/to/script_name at the beginning like . /path/to/profile.sybase and execute your cron line su without the -:
su sybase -c "/path/to/script_name"
Or you would have to add tests for interactive shells in /etc/profile /~HOME/sybase/.profile...
All the best
Victor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2006 04:35 AM
тАО09-14-2006 04:35 AM
Re: /etc/profile Specify a parameter with this command
if [ -t 0 ]; then
... # interactive
else
... # not interactive
fi
It worked like a charm. Was very self documenting as to what it did, and what to do (I am not a UNIX admin).