The Shell script keeps hanging
Hello,
I have the following shell script and when i execute, it keeps hanging and nothing happens
Please let me know.
Requirement is to read data from file and pass it to the sql and create files as shown.
code
#!/bin/sh
while read user.dat
do
echo "user = $1 email = $2"
done
sqlplus -S /NOLOG << EOF
connect username/pwd@schema
select user_name,count(*) from apps.fnd_user
where 1=1 and user_name ('$1') and email_address ('$2')
group by user_name;
EOF
if [ $? -ne 0 ]
then
% cat > user_exist
else
% cat > user_notexist
fi
exit 0
Data File
rsreenivasa null
Well, youy have many problems here:
while read user.dat
do
echo "user = $1 email = $2"
done
The "user.dat" string is an invalid variable name, so this loop never runs.
Then, in this sequence:
if $? -ne 0
then
*% cat > user_exist*
else
*% cat > user_notexist*
fi
The cat(1) commands then copy stdin to either "user_exist" or "user_notexist".
You don't show how you run this command, so we cannot tell what happens exactly.
Please delete everything below the "while read ..." loop. Get that loop working as you expect it should. Then add a few more lines and test those. Build the shell script incrementally, debugging each as you go.
Hint: since this is a shell script, run it like this:
$ sh -x ./myscript arg1 arg2 ...
to see what happens as it happens.
Cheers
Similar Messages
-
Error when running the OWB process flow from the shell script
Hi,
I am able to deploy the process flow succesfully but when I execute the process flow from the shell script,I am getting the following error.Previously it worked fine.
I had to make some chnage in the IP address,so i had to deploy again.
Connected.
SQL> @/oracle/product/owb92028/owb/rtp/sql/oem_exec_template.sql OWB_RTR LOC_P_REL PROCESS P_W_SOURCE "," ","
Elapsed: 00:00:00.00
Elapsed: 00:00:00.01
Stage 1: Decoding Parameters
| location_name=LOC_P_REL
| task_type=ProcessFlow
| task_name=P_W_SOURCE
Stage 2: Opening Task
declare
ERROR at line 1:
ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at "OWB_RTR.WB_RT_API_EXEC", line 17
ORA-06512: at "OWB_RTR.WB_RT_API_EXEC", line 137
ORA-06512: at "OWB_RTR.WB_RT_API_EXEC", line 164
ORA-06512: at line 205
Thanks in advance.
VinayHi Kamal and kanakam kolla,
This is just to let you know that,I solved my problem little differently by creating a new location and deployed the process flow.Now my process flow is working fine when i call from the shell script.What i see is that, it does not update properly when we update and redeploy the process flow.So far this is the work arround i could think off and i succesfully tested this.
Thank you Kamal and kanakam kolla,for giving a thought towards my problem.
Thanks
Vinay -
Where is the Shell Script directory?
I have been asked to run a script in the Shell Script directory.
I found the directory /library/scripts ... when I ran the script in there I did not get the expected results, so I assume the directory is incorrect.
Please help..AFAIK, that folder's for AppleScripts, not shell scripts. For shell scripting, see https://developer.apple.com/library/mac/#documentation/OpenSource/Conceptual/She llScripting/Introduction/Introduction.html
-
Automator workflow "run shell script" keeps running. How to stop?
Because i want two instances of dropbox running simultaneously on my Mac, I set up a small automator workflow application. The workflow consist of a simple shell script:
Or in text:
bash
HOME=$HOME/Dropbox-quivertree /Applications/Dropbox.app/Contents/MacOS/Dropbox &
The problem is that once the application runs, or i execute the script from within automator, it just keeps running (i get the little cog in my menubar). Anybody have an idea how to automatically stop after it has launched dropbox?
Thanks!
KimI do not have dropbox on my computer, so I tested using the Calculator application. The solution proposed by Mattis S.F. does work, but his explanation does not hold true in my case. Initially, I successfully tried
HOME=$HOME/Dropbox-quivertree nohup /Applications/Calculator.app/Contents/MacOS/Calculator >/dev/null 2>&1 &
If I remove the “nohup”, the result does not change. Removal of the “/dev/null 2>&1”, however, results in the same problem originally described by Kim van der Leeuw. My guess is the background process has stdout and stderr redirected by default back to the automator. When redirected to /dev/null, the automator no longer waits for the background process to complete. To summarize, change
HOME=$HOME/Dropbox-quivertree /Applications/Dropbox.app/Contents/MacOS/Dropbox &
to
HOME=$HOME/Dropbox-quivertree /Applications/Dropbox.app/Contents/MacOS/Dropbox >/dev/null 2>&1 & -
Do the shell script have to login into Oracle Apps
I am calling the Document Processor Java API from a shell script. The problem I have that its unable to find the
xdo://PO.POXPRPOLXMLRTF.en.US/?getSource=true
file within the control file.
Is this because somewhere a shell variable needs to be set, or a login need to be made into the Oracle Apps, so this template stored in XML Publisher is accessible.
Please advise!Another things you can do is
begin
tmp_res := apps.fnd_web_sec.CHANGE_PASSWORD('TESTUSER','changeme',false);
update fnd_user set password_date = null where user_name = 'TESTUSER'';
end;
Once you do this, when the TESTUSER logs in with the password=changeme, he/she will be redirected to the change password page.
Hope this helps,
Sandeep Gandhi -
Hi,
i am working on supporting side for a migrated project.My application is an ASO.
As i have to execute the MaxL scripts in Unix using shell scripting.
Can any one help me out in writing and executing the scripts in Putty server.
it is very apreciable if i get response soon to my id [email protected]
Thanks and waiting for reply.
SrinivasWe are using Essbase on UNIX (AIX) too. Generally speaking, I always create 2 files when I want to execute a MaxL script on our UNIX server:
1) a shell script, eg. proc.sh, that contains "essmsh -l <user> <password> proc.msh".
The proc.sh file can be edited using the standard UNIS editor "vi" and needs to be executable (the "x" bit needs to be set).
2) the MaxL script, eg. proc.msh, that contains the MaxL statements to be executed on Essbase
Hope this helps. -
Calling the shell scripts written in Apps Server via DBMS_Schedueler
Hi All,
I am new to DBMS Shceduler.
I had written shell scripts in Application Server(Not in Database Server).
Is any one can advice me whether these shell scripts can be called via DBMS SCHEDULER?
Thanks in Advance
Regards
A.GopalYes.
Generally a Scheduler will have 3 parts, a Schedule, a Program and a Job. The parameter "program_type" in "Program" that can have these values 'PLSQL_BLOCK', 'STORED_PROCEDURE','EXECUTABLE'. The "EXECUTABLE" setting allows you to call a script as you request.
Schedule Example
begin
dbms_scheduler.create_schedule
(schedule_name => 'DAILY_AT_4PM',
start_date=> trunc(sysdate)+18/24,
repeat_interval=> 'freq=daily;byhour=16;byminute=0;bysecond=0',
comments=>' Run at 4pm every day');
end;You can setup and reuse something like the above for a job you want to run daily at 4PM
You can check schedules by running some SQL like this :
select schedule_name, schedule_type, start_date, repeat_interval from dba_scheduler_schedules where owner = 'SCOTT';
Program Example
BEGIN
DBMS_SCHEDULER.CREATE_PROGRAM (
program_name => 'MY_SAVED_PROGRAM1',
program_action => '/usr/local/bin/date',
program_type => 'EXECUTABLE',
comments => 'My comments here');
END;
/You can check Programs by running some SQL like this :
SELECT owner, program_name, enabled FROM dba_scheduler_programs where owner = 'SCOTT';
Job Example
begin
dbms_scheduler.create_job
(job_name => 'JOB_EXAMPLE',
program_name=> 'MY_SAVED_PROGRAM1',
schedule_name=>'DAILY_AT_4PM',
enabled=>true,
auto_drop=>false,
comments=>'Job to run date');
end;You can check Jobs by running some SQL like this :
SELECT owner, job_name, enabled FROM dba_scheduler_jobs where owner = 'SCOTT';
The forum also has its own section for this which you can find here :
Scheduler
Best Regards
mseberg -
How to pass a variable to the shell script and crontab?
Friends,
here is my script.....
exp userid=username/password@realdb file=/u02/logical_backup/abc_+$date+.dmp log=/u02/logical_backup/abc_+$date+.log owner=oraadmin statistics=none
i want the exported file name as abc_2101.dmp and abc_2101.log (2101 is a date and month)
I want to execute this script daily at 02:00 AM.
so that i edited the crontab -e as....
00 02 * * * ./u02/script/dailybkp.sh
Now what i want is....
1. is the steps are correct for crontab -e?
2. Is the script of the crontab will execute daily at 02:00 AM?
3. how can i rename the .log filename and .dmp file name daily according to the date. for example abc_2001 is today's date and month.how can i replace with the variable.
thanks
sathyguysorry....i tested with cp command it was working fine...
so, i thought it should work for exp command also.
but its not working....also its not throwing any error....
the crontab -e is having...
00 02 * * * exp userid=system/password@realdb file=/u02/test/n22.dmp log=/u02/test/n22.log owner=scott statistics=none
also i have tested by calling the script.
#!/bin/bash
00 02 * * * /u03/script/testbkp.sh
its not working
but the below one is working....
00 02 * * * cp /u02/test.txt /u02/test/test.txt
also this one is working....
#!/bin/bash
00 02 * * * /u03/script/testbkp.sh
i listed the chkconfig --list crond
crond 0,1,6 = off
2,3,4,5 are on
what might be the reason?
thanks
sathyguy -
I want this so I can just download anything I want by just having the link and I have made a few things with shell scripts in automator before, just never anything where i need to input a value into the shell script.
Easy:
-
How to switch user from the current user using shell script code
Hi Experts,
I have an requirement to login into a particular user from the shell script concurrent program. I do have credentials for that particular user. I want to login and run few commands from that particular user. Please let me know if there are any methods to login as a particular user using the username, password from shell script program.
Thanks a lot.Thanks for your reply. However we cannot use su command from a shell script program. How to enter password from shell script program?http://tinyurl.com/3t7cwjh
Thanks,
Hussein -
The new SQL Developer keeps hanging!
http://www.oracle.com/technology/software/products/sql/index.html
SQL Developer give me a break!
I installed this software for the ease of retreival of data from the database, but on the contrary it keeps hanging and has now become a nuisance to use it.
It affects the productivity to a great extent since it keeps me waiting for too long while it fetches data.
Before this I had used Toad(which is not used here anymore), and never had any such problems with it.
In the SQL Developer, the records fetched are now editable. But I don't see that as a boon to us. Infact scrolling through the record to the end has now become a pain. Before to scroll throught a record all you needed to do was press the <-- or
--> keys. Now thats not possible.
Plus, it seems more unstable than the previous version. It just hangs more than before.-followup-
Hi,
Getting extra popup menuoptions in the navigator is really easy (thanks Kris Rice for the skeleton on http://esdev.sourceforge.net/)
I'll try to rewrite some GeoRaptor code so the menu-options will work for SQL Developer 1.1.
Does anyone know some docs/examples for submenus/icons in the navigator popup ?
--olaf -
Problem with the run_job,shell script with sqlldr
Hi Gurus,
I Created a job which calls the shell script and i understood from the other posting this job is going to execute with nobody,
I had done the below testing
Test 1) Shell script calls the SQL file, this SQL file executes the procedure.
Test 2) Shell script calls the sqlldr command.
When i execute the Test cases with , dbms_scheduler Run_job procedure, Test1 is success but Test2 was failed
When i execute the Test cases with, logging into box with owner of the shell & both test cases are successful.
Parent folder & Shell files are given with 777 permissions. & the Oracle db is version 10.2.0.1.0.
Error:
STANDARD_ERROR="SQL*Loader-522: lfiopn failed for file (*.log)"
Please provide me your inputs its bit urgent Thanks a lot for your help.
Edited by: 926769 on May 23, 2012 2:27 PMFirst of all let's look at your environment ... a totally unpatched version of software that is so old it is in desupport mode. You should upgrade to a fully supported version but, if you can't, at least to 10.2.0.5.
That said without seeing any of your code, or a listing showing permissions on the directory and files, there is insufficient information from which to help you.
Please post ALL information required for us to understand what you are doing an your environment.
But before I decided that NOBODY was doing anything ... I'd shell out to the server from SQL*Plus using the HOST command and verify that permissions are as you believe them to be. There is every reason to believe SQL*Loader is having an issue with your file as identified. -
Setting from address on linux to receive the mail after shell script ran
Hi,
I scheduled some shell scripts on Linux as cronjobs. Once the shell scripts are executed at the scheduled timings i am receiving the mails as shown in the below. PRDORA, TSTORA, DEVORA are my environments.
From Subject Size Received
oracle dbora01cocen.corp.psi:PRDORA RMAN Archive Completed using Control file 11 KB Wed 8/13
[email protected] TSTORA:[14]ORA-12012: error on auto execute of job 854 10 KB Wed 8/13
[email protected] DEVORA:[7]ORA-12012: error on auto execute of job 1524 68 KB Wed 8/13
In the FROM address:
I should receive the mail format: oracle@hostname in the FROM address like shown below.
From Subject Size Received
[email protected] PRDORA01 RMAN Archive Completed using Control file 11 KB Wed 8/13
[email protected] TSTORA01:[14]ORA-12012: error on auto execute of job 854 10 KB Wed 8/13
[email protected] DEVORA01:[7]ORA-12012: error on auto execute of job 1524 68 KB Wed 8/13.
Rightnow this dbora01cocen.corp.psi is mixing up with the subject in PRDORA instead it should in the FROM address. Can anyone please guide where i am suppose to make modifications in order to get this change.
ThanksSorry for the Late Reply.
What does:
$ /bin/hostname
return for each of these environments?
FOR DEV:
[email protected][DEVORA01]% /bin/hostname
devora01coden.corp.psi
FOR TEST:
[email protected][TSTORA01]$ /bin/hostname
testora01coden.corp.psi
FOR PRD:
[email protected][PRDORA01]$ /bin/hostname
dbora01cocen.corp.psi
Are you using a local DNS or /etc/hosts entries to assign host names to IP addresses?I am not sure about this but i looked at /etc/hosts in each server and found the entry of the individual server on all the 3 servers.
Thanks -
UDM and shell scripts and working with the ENVIRONMENT variable options
In Userdefined metrics you have the ability to pass envronment variables.
I was going to send
DIR=/db/db05/oradata/ORCL/hot
How to handle whats passed to the shell script?
It passes $1 as {DIR=/db/db05/oradata/ORCL/hot}
yes with the brackets. Here I figured it would simply set the DIR environment variable.
Any cool tricks to work with this mess?
Is it meant for perl scripts instead?
Daryl.Ilmari Aalto wrote:
Hi Darth,
Thanks for your hint! Nevertheless I think it's something more profound, since there's no error etc. For example, should I have the path wrong I assume that OWB would return me some kind of an error when it doesn't find the .sh-file? Isn't there any log-file to see whether the command was executed? It seems like the execution of the User Defined element would be skipped altogether.
Cheers,
IlmariNo, if you don't give an absolute path OWB will not return any error, it just wont do anything at all... -
How to use the result of simple shell script?
The shell script below retrieves the length of an audio file:
set aFile to choose file
do shell script "afinfo " & quoted form of (POSIX path of aFile) & "|grep duration"
I'm wondering, how can I copy the result to the clipboard or set the value of a variable to it?
Total newbie question. I have no idea about shell scripts - I just found the script above online.
Thank you so much!Here:
set the clipboard to (do shell script "afinfo " & quoted form of (POSIX path of aFile) & "|grep duration")
or:
set A to do shell script "afinfo " & quoted form of (POSIX path of aFile) & "|grep duration"
(53997)
Maybe you are looking for
-
MY iPod touch is disabled ans says retry again in 22000000 minutes. When I attempt to restore, the software downloads but the device does not restore. How do I bypass the disabled screen to put the iPod back in working order? Please help.
-
KB2863926 - Word update (Other office patches also shown as updated)
Hi Recently updated April 2014 MS security patches on our Win7 SP1 machine. One of the patches i am applying is (KB2863926), which is a word2010 patch. However, noticed in Program Features, that bucket load of other office related updates are shown t
-
Dear Experts, We have a scenario, where the sales order will be created with reference to the rate contract and the pr should be generated automatically. What are the settings we need to do to get an automatic PO. This is not third party sale. Thanks
-
Retrieving tags and corresponding text within textFrame
I have a text frame that looks like this: starting with a reference to the pageitem, I want to be able to get a list of the tag names and the text that corresponde to them. In this example the red tag is "text1" the green tag is "text2" and the blue
-
Permission problems. new to snow lepored
Hi i just recently bought an appple mac pro from ebay it came with snow lepored installed. i have been having some permission problems and need some help fixing then. here are the problems that are not getting repaired through the disk utility. Permi