shell script read non-interactive
hi everybody;
I have a rhel4u3 A.S server; oracle db 10g and oracle IAS application server is installed ; to set enviorement variables ;I have added some lines to .bash_profile of the oracle user ; [root@orcl ~]# su - oracle 1. Database 2. Application Server according to the selection enviorement variables and paths are set ; here is the code ; 1 # .bash_profileTo sum up when the user logs in then ; he enters 1 or 2 to set the variables interactively; The thing ı want to do is to start the database and application server when server reboots ; so I edited the /etc/oractab file and added the a service named dbora; as S99dbora and K01dbora to run level 3,5 but when the service tries to start ; the menu appears and wants a selection ; how can I prevent this happening and giving parameter ; ın fact I thougt to set the variables in the dbora service but then it would be executed as root ; but oracle must be started with oracle user ; so I used the way seen below ..
That is all ; tahnks for ant help.. Tamer ONEM RHCt --- > but will be RHCE :) |
have you already tried to play around with the $0 variable? i'm not sure but perhaps if you soft-link a script file then execute the soft-link, $0 will be different.
for example Code:
# cat >scriptfile.sh <<EOF |
hi dear konsolebox;
hmm I think I could not tell my problem exactly ; The problem is trying to bypass a read action in a script; without any user activity.. ! But thanks anyway :) |
what i mean was as continuation to the code... we can have
Code:
if [ "$0" = "db" ]; then Code:
if [ $ans -eq 1 ] || [ "$0" = "db" ]; then regards |
Quote:
Since i'm pretty tired now so deciphering the code is up to you. but you need the read command this is from the Suse and Mandriva startup script Code:
# |
so what should be done here?
|
two ways to overcome the problem
Hi everyone ;
after a month later :) I am retruning with 2 valid solutions ; 1.way I was trying to read an input because of setting enviorement variables for database server (DB) or internet application server (IAS). By setting the env. variables inside the script no read action will be required. But this solition has an handicap that; the user will not be asked for selection so only db or ias variables will be able to set. 2.way one of my prof. at univesity used to say that "the first solution you have just found is always the worst one " :) Yes the second is setting a time limit for selection then assinging a default value ; See here ; then the ans would be 33 if user did not enter an input for 2 seconds time. I don't know if anyone will face this kind of problem but it helped me; wish this will help others too ; thanks for all posts. |
All times are GMT -5. The time now is 06:25 AM. |