Logic - Am I running interactively or no?
Hi all,
I've found several hits in researching my issue, but none seem to touch on my exact issue. When logging into my RHEL 6 server as the oracle user (korn shell), .profile calls the oraenv script to set the environment, which prompts the user for input. I'm trying to write logic that says, in pseudo-code: if this session is interactive, run oraenv else, don't Oracle delivers init scripts to start and stop oracle services on shutdown and startup. The scripts use the su - oracle -c blah syntax to stop and start oracle services, but because .profile calls oraenv, the system is prompted for input. Thanks! |
problem solved
the logic I used to resolve this is:
if tty -s ; then my settings fi |
Usually there are already tests in startup scripts to determine if a login is interactive versus not. Either case, the old BASH tried and true has always worked for me:
Code:
if [ -z "$PS1" ]; then Code:
case "$-" in |
There are some methods here http://www.tldp.org/LDP/abs/html/intandnonint.html
|
All times are GMT -5. The time now is 05:25 AM. |