Issue with running multiple commands withing su command
RHEL 6.2/Bash shell
root user will be executing the below script. It switches to oracle user and expect to do the following things
A. Source the environment variables for BATGPRD Database (the file used for sourcing is shown below after the script)
B. Shutdown the DB from sqlplus -- The section between EOF takes care of this
C. execute ps command and grep for the string pmon
D. Execute srvctl start command to start the database
Commands for A,B,C and D and enclosed in a single quote delimited by colons.
Issue description:
DB is shutdown succesfully from sqlplus (A & B ). But ps command and srvctl commands shown in red are not executed.
The exit command shown below (in green below) is actually the exit from sqlplus. I don't if this affecting the execution of remaining
sections of the script.
Hi Chubler,
Your idea of passing DB name as a parameter is great. Hope it won't treat $database as a literal because of the double quotes. Let me try to modify the script as per suggestion. If it works, it will make my script much more flexible. Thank you ChublerXL
Hi vbe,
As you can see above, OP used just single quotes to enclose multiple commands. So double quotes are not actually needed when you have multiple commands. Right ?
I am working on script. it reads a file which contains multiple lines
Ex;
curl --write-out %{http_code} --silent --output /dev/null http://hostname:port/input=1
curl --write-out %{http_code} --silent --output /dev/null http://hostname:port/input=2
curl --write-out %{http_code} --silent ... (2 Replies)
Hi All,
I have put a perl script together to go and collect some information from multiple nodes/endpoints. The script works absolutly fine however I want to make it quicker.
You will see in the below that my script calls an expect script called ssh_run_cmd2.exp followed by the IP of... (7 Replies)
RHEL 6.2/Bash shell
root user will be executing the below script. It switches to oracle user logs in using sqlplus and tries to
run the below UPDATE statement. All the commands after su -c are enclosed in a single quote delimited by semicolon.
The execution has failed because the quotes... (3 Replies)
I'm trying to copy files from a remote windows server to Unix server. I was successfully able to copy files from windows server using command prompt but when I run these commands from a script it's not working as expected. commands used:
sftp user@remoteserver.com
lcd local_dir
cd... (3 Replies)
Hi,
Is there a way in Korn Shell that I can run multiple commands stored as a semi-colon separated string, e.g.,
# vs="echo a; echo b;"
# $vs
a; echo b;
I want to be able to store commands in a variable, then run all of it once and pipe the whole output to another program without using... (2 Replies)
Hi All,
Is there anything wrong with below syntax?
qx {perldoc -v ModuleName.pm | grep -i Description }
BTW, this question is related to Perl.
Thanks. (3 Replies)
In mysql, I can get what I want from a database without having to log into mysql. works great for me and it is perfect.
now, i want to be able to do the same in oracle but I dont know how to.
For example, if i want to retrieve information from the mysql database from the command line, i issue... (4 Replies)
Hi all,
I'm using awk in a .ksh script to split one file by line prefix into different files (up to 4). The files are named after the prefix in the line, and a sequence no.
Is there any way to get the filenames in to variables too? I need _ftpfile1, _ftpfile2, _ftpfile3 and _ftpfile4 which are... (2 Replies)
Hi,
I would like to write a script with include more than 6 unix commands.
my script like below:
echo " script started"
ls -ld
bdf | grep "rama"
tail -10 log.txt
...
..
...
now, i want to run above unix commands one by one.
example:
first the ls -ld command will be... (3 Replies)
I'm trying to run a script file with multiple commands that I would normally type into the command line. The commands are:
#!/bin/bash
diff Test1.o0 /usr3/ronelso4/Desktop/verificationKPC/Test1.o0 > differences2
diff Test1a.o0 /usr3/ronelso4/Desktop/verificationKPC/Test1a.o0 >> differences2... (1 Reply)