Getting return code from remote script after Unix rsh call

I hope one of you guys can help me with this issue. I think I've gotten the 'rsh' command to work from the CES application so that the sqr report generation can execute on a remote machine (instead of the app server machine). I'm actually doing this by having the app still execute the ces_sqr script, however, now the ces_sqr script will just have an 'rsh' command in it which will cause the actual real sqr processing to occur remotely.
I am executing a Unix script which does a remote shell call to another script on a remote machine. The remote script sends a return code when run locally, however, how can I get the calling rsh script to get that return code?
If I do the following in the rsh script:
rsh -l resdev morph "/dev/bin/remote_script"
rc=$?
echo "$rc\n"
then the return code that I get is not actually the return code from the remote_scrpit, but it is the return code from the rsh command that is 0 (success) because the rsh command actually executed successfully even though the remote_script could've returned something other than success. How can I get the return code from the remote_script passed back to the rsh calling script?
Jan Miller
[email protected]
202-237-9584

Please ignore the first paragraph of my previous post.

Similar Messages

  • Getting return code from subprocess execution

    Hi,
    I am executing a batch file as a subprocess and need to get the return code from it.
    The batch file executes a java class, which exits (System.exits(rc)) with a return code on error and how this can be captured in the calling program.
    i am calling the batch file as follows: (fragment)
    Runtime r;
    process p = r.exec(execCmd, null, mqsiToolFile);
    istr = p.getInputStream();
    br = new BufferedReader(new InputStreamReader(istr));          
    returnCode = p.waitFor();
    System.out.println("exit value: "+p.exitValue());
    This successfully executes the subprocess and always returns with code '0', even though the sub-process exits with a code >0.
    p.waitFor() or p.exitValue() - doesn't giving the exit value of the subprocess.
    How can i capture the exit value (System.exit(rc)) from the sub-process.
    I am running the app on Windows NT4 sp6
    Any help would be greatful.
    Thanks in Advance.

    Peter,
    can u be more explanative on this, i can see the run time result (0, 1). But couldn't get familiar on the sample you have given.
    My code is as follows:
    Process p = null;
    Runtime r = Runtime.getRuntime();
    for loop {
    execSubProcess(.., .., ..)
    public int execSubProcess(String excmd, String[] env, File fileDir) throws Exception {
    int res = 0;
         try {
              System.out.println(excmd);
              p = r.exec(excmd, null, fileDir);
              istr = p.getInputStream();
              br = new BufferedReader(new InputStreamReader(istr));
              line = null;
              while ((line = br.readLine()) != null) {
                   System.out.println(line);
              res = p.waitFor();
         System.out.println("sub-process return code: "+p.waitFor());
              System.out.println("sub-process exitValue: "+p.exitValue());
         } catch (Exception e) {
         throw e;
         return res;
    Here i get all the time 'res=0' , even though the subprocess execCmd exits with a return code > 0.
    Is tehre any environment setup or ..needed to capture the subprocess exit code val (System.exit(rc)) in the calling program.
    Please provide more details as per ur convinience.
    thanks

  • Getting return value from sqlplus script while running a unix job

    I am trying to run a unix script that calls sqlplus. The following code outlines the unix/sql code that I trying to execute:
    return_count=`sqlplus $ORACLE_ID/$ORACLE_PWD@$ORACLE_SID <<EOF | grep '^RETURN_VAL' | sed 's/^RETURN_VAL//'
    SET SERVEROUTPUT ON
    VARIABLE ReturnValue NUMBER
    EXEC :ReturnValue := 1
    BEGIN
    UPDATE seq_control_nbr
    SET table_seq_nbr = table_seq_nbr + 1,
    last_updt_dttmstp = systimestamp,
    last_updt_user_id = 'ECVMSONS'
    WHERE table_key = 'ONSTAR';
    IF SQL%ROWCOUNT = 1 THEN
    COMMIT;
    :ReturnValue := 0;
    ELSE
    ROLLBACK;
    :ReturnValue := 99;
    END IF;
    DBMS_OUTPUT.PUT_LINE ('RETURN_VAL '||:ReturnValue);
    END;
    EXIT
    EOF`
    The above outlined sqlplus script does run because the values on the table are updated. However, I cannot get the value of ReturnValue to be displayed, so it can be returned to the unix script.
    Any ideas?

    ok do the following:-
    return_count=`sqlplus $ORACLE_ID/$ORACLE_PWD@$ORACLE_SID <<EOF
    SET SERVEROUTPUT ON
    whenever OSERROR exit 1
    whenever SQLERROR exit 2
    UPDATE seq_control_nbr
    SET table_seq_nbr = table_seq_nbr + 1,
    last_updt_dttmstp = systimestamp,
    last_updt_user_id = 'ECVMSONS'
    WHERE table_key = 'ONSTAR';
    EXIT
    EOF`
    rowsupdated=`echo $return_count|cut -f1 -d' '`
    echo "Rows updated =" $rowsupdated
    retcode=`echo $?`
    case "$retcode" in
    0) echo "Update executed successfully on " ;;
    1) echo "Update failed OSERROR ";;
    2) echo "Update failed SQLError " ;;
    *) echo "Update failed - Unknown Error ";;
    esac

  • Error Getting return code while FTPing file through JAVA

    Hello experts
    My requirement is to send file to Mainframe server in a JOBQ.I used a socket to connect to server. A designated FTP ID is provided for authentication.
    I tried to FTP file to mainframe sever, but while getting return code from server, i m recieving Junk values.I am reading return code through BufferReader.readline().
    I have set up the connection mode to ASCII mode.I tried to set up the connection mode to EBSIDIC mode too, but i revieve the same error.
    Any one have tried to FTP file to mainframe in got the same error.What could be the possible reason.
    Here is the error looks like :-
    Inside SocketClient() class, in connect(String hostname, int port) socket = Socket[addr=xxx.xx.xx.com/xx.xxx.xx.xx,port=21,localport=2500]
    Inside SocketClient() class, in connectAction() method (InputStream) input = java.net.SocketInputStream@696fc610
    Inside SocketClient() class, in connectAction() method (OutputStream) output = java.net.SocketOutputStream@695b8610
    Inside FTP class, in __getReply() method _controlInput = java.io.BufferedReader@15370617
    Inside FTP class, in __getReply() method Line = ��&�&#63641;����(��&����/������<�������<&#63641;��|(?>
    Any help in this topic is appriciated
    Regards
    Samit

    This is the third party API's i have used
    http://www.enterprisedt.com/downloads/ftp.html
    download this.
    Version 1.2.1 (Jan 29, 2003). Download here. (tar.gz format. WinZip will unpack this). Compiled/tested for JDK1.4.x. Will work for 1.3.x etc

  • Return codes from sqlplus_exec_template

    OWB'ers
    Environment:
    OWB 10g (10.1.0.2.0)
    Repository and target schema - Oracle9i (9.2.0.4) on AIX 5.2
    I am executing the 'sqlplus_exec_template.sql' script to execute a Process Flow. It executes the Process Flow just fine.
    When I put the SQL*Plus command line in a UNIX script as so:
    sqlplus -s owb_rtu/owb_rtu @sqlplus_exec_template OWB_RTR GWW_FLOW_LOCATION_1 PROCESS LOAD_BUSINESS_UNITS "," ","
    ... and then test the return code using $?, it returns a '1' for a successful execution.
    I understand that the package that is executed by the SQL script (wb_rt_api_exec) will return 1=success, 2=warning and 3=error. No problem.
    However, when I test the return status of the actual SQL*Plus command I also get a '1' when the PL/SQL script executes successfully!!??!!??
    The log file produced from the SQL script shows the following:
    Session altered.
    Role set.
    Stage 1: Decoding Parameters
    | location_name=GWW_FLOW_LOCATION_1
    | task_type=ProcessFlow
    | task_name=LOAD_BUSINESS_UNITS
    Stage 2: Opening Task
    | l_audit_execution_id=12300
    Stage 3: Overriding Parameters
    Stage 4: Executing Task
    | l_audit_result=1 (SUCCESS)
    Stage 5: Closing Task
    Stage 6: Processing Result
    | exit=1
    PL/SQL procedure successfully completed.
    So, if the PL/SQL procedure completes successfully, why do I get a '1' return code to my UNIX script?
    UNIX thinks that is an error condition.
    When I purposely made an error in my SQL*Plus command line the UNIX script returned a '1', as expected, when encountering a script error.
    How then do I tell the difference between a SQL command error that returns a '1' and a successful completion of the PL/SQL package that also returns a '1'?
    I have tried the Process Flow with the 'Use Return as Status' set to both True and False with the same results.
    I am trying to set up scripts that will run in Autosys and I need to check the return codes of the jobs and notify the appropriate people if there is a problem. Like UNIX, Autosys thinks a '1' return code is an error condition.
    So it appears that the SQL*Plus command invoked in a UNIX script is returning the exit status of the 'wb_rt_api_exec' package invoked in the SQL script and not the actual result of the PL/SQL procedure that calls the package.
    How do I get the SQL*Plus command executed from the UNIX script to return a zero (0) upon a successful completion and a non-zero upon an error?
    Is the package somehow overpowering the return code from SQL*Plus?
    Any help is greatly appreciated.
    Gary

    Jean-Pierre
    Thanks very much for the response. I will find that SQL script you mention and see if I can use it or modify it to meet our needs.
    We have standardized on using Autosys as our job scheduling product and are using it for all the ERP jobs in addition to the ETL jobs.
    In that light I would be very interested in having a closer tie between OWB and Autosys. We aren't in a position to be a very good beta customer at this point due to a very tight implementation schedule for the next few months. After that it might be possible for us to help test that new functionality.
    Thanks again, we really appreciate your efforts in this discussion group.
    Gary

  • Are return codes from APIs different when upgrading DOT from 8.0.3 to 8.1.4/8.2.3 (7-mode only)

    Customer is looking to upgrade from DOT 8.0.3 to 8.1.4/8.2.3 (7-mode). There are no real API changes between these upgrades other than additional functionality being added. Howver, are the return codes from APIs any different when upgrading DOT from 8.0.3 to 8.1.4/8.2.3 (7-mode only)? Any help on this to help confirm would be greatly appreciated. Many Thanks in advance. Luke

    Thanks. I had the Portal 3.0.6/3.0.7/3.0.8 to Portal 3.0.9 upgrade scripts and instructions, but thought that was my last step. I hesitated on running the Portal Configuration Assistant. None of the instructions told me what to do at this point.
    Anyways, it looks that by running the Portal Configuration Assitant at the end of the 1.0.2.2 9iAS install, it created a new repository for Portal 3.0.9 in my database. Since I gave it a different schema name, I now have two portal repositories. The old Portal 3.0.6 repository (jvac_portal30) and the new Portal 3.0.9 repository (j_portal30).
    So, I assume I have to perform the upgrade scripts on the Portal 3.0.6 repository to get it to 3.0.9. Since we really did not have very much in the repository, we may just manually recreate everything in the new 3.0.9 repository. I have ssen several discussion threads about the upgrade and problems, so I am very leary to do it.
    In regards to our J Server propblem, we left for lunch. Came back and rebooted several more times, double checked all our configuration files (made no changes), stopped and restarted Apache several more times, and then by some miracle everything started working.
    null

  • While upgrading Adobe Creative Suite CS4 ME into Adobe Creative Suite CS5.5 Design Premium, I get an error saying This serial number is not of a qualifying product, please try another. I used to be able to get a code from customer service but I can't get

    While upgrading Adobe Creative Suite CS4 ME into Adobe Creative Suite CS5.5 Design Premium, I get an error saying This serial number is not of a qualifying product, please try another. I used to be able to get a code from customer service but I can't get to the chat. Please advise!!!!

    MoeGhazal I reviewed your account and it looks like you have have upgraded from a CS4 volume license for Design Premium to a retail upgrade of Design Premium 5.5.
    I also show that you made two purchases of CS5.5 Design Premium but the second purchase was canceled.  Please make sure you are utilizing the serial number which ends in 7886.
    If you are using the correct serial number then it is likely the installer will not recognize your volume license CS4 serial number as being valid for an upgrade.  If you can contact our support team then you can be walked through an unlocking procedure to allow you to proceed with the installation.  You can contact our support team directly at Contact Customer Care.  You may want to try installing a web browser you have not previously utilized.  It is likely a toolbar or some other software application is affecting your ability to access chat support successfully.
    If you are still unable to reach our support team then please verify the information under your account is accurate.  If you can please then update this discussion after confirming this then I can request a member of our support team contact you directly.
    Again I would recommend reaching out directly if possible as it will be the most efficient method of resolving your current error.

  • Error in LSMW getting return code 6

    Hi all,
                 i Am getting a  Error in LSMW getting return code 6 , after asign a file , in the read data step i am getting the error , please help me it is very urgent,
    sridhar

    Hi,
    If the Sy-Subrc is 0 then Success, if the Sy-SUBRC is 4 then failure, if the Sy-SUBRC = 6 then the user might be not access to read the file
    AUTHORITY-CHECK sets SY-SUBRC to 0 if the user has the necessary authorization, otherwise 4, 8, 12, 16, 24, 28, 32, or 36 depending on the cause
    Regards
    Sudheer

  • Getting return code as 1 for SD_SHIPMENT_PROCESS_HU

    Hi All,
    Could you please tell me what is the use of SD_SHIPMENT_PROCESS_HU function module.
    I am debugging one standard program in that after processing  this FM in  SD_SHIPMENT_PROCESS Function module getting return code is 1.
    Could you please tell me,what might be the reason.
    Thanks in Advance.
    Regards,
    Rama.

    Hi Rama,
    if you will look into the specified function module
    CALL FUNCTION 'SD_SHIPMENT_PROCESS_HU'
      IMPORTING
        e_logfile =                 " v56e_logfile
      CHANGING
        c_activities =              " v56e_shipment_activities
        c_shipment =                " v56e_shipment
      EXCEPTIONS
        ERROR = 1                   "
    so if you are getting returned code as 1, it means there is any error.

  • Capture return code from system command?

    Can someone please tell me what is the easiest way to capture the return code when executing a system command?
    In other words I wish to execute a say a perl script and capture the return code from it.
    Any help is appreciated.

    Process p = Runtime.getRuntime().exec("blah.exe");
    p.waitFor();
    System.out.println("Return code from blah.exe"+ p.exitValue());

  • Return code from Client_host command

    Hi,
    Is it possible to get the return code from the os when I issue the webutil Client_Host procedure?
    Thanks,
    Mary

    Mary
    You can use the WEBUTIL_HOST.HOST method instead of CLIENT_HOST. It is overloaded as both a Procedure and a function; the latter returns the client return code.
    Cheers, APC

  • Datasync.Write:return code from activesync_setup_5.pyc:1

    Hi all,
    I am testing Mobility Service 2.0.
    Test server is a sles11sp3 with nothing else running. Placed in dmz with GroupWise server on lan.
    Log snip:
    Wed Feb 12 22:22:56 CET 2014: Datasync.Write:executing: MUSER='datasync_user' MUSERPASS='******' /opt/novell/datasync/syncengine/connectors/mobility/cli/postgres_setup_1.sh
    Wed Feb 12 22:23:43 CET 2014: Datasync.Write:return code from postgress_setup_1.sh:0
    Wed Feb 12 22:23:43 CET 2014: Datasync.Write:executing: python /opt/novell/datasync/syncengine/connectors/mobility/cli/odbc_setup_2.pyc
    Wed Feb 12 22:23:43 CET 2014: Datasync.Write:return code from odbc_setup_2:0
    Wed Feb 12 22:23:43 CET 2014: Datasync.Write:executing: python /opt/novell/datasync/syncengine/connectors/mobility/cli/mobility_setup_3.pyc ...
    Wed Feb 12 22:23:44 CET 2014: Datasync.Write:return code from mobility_setup_3.pyc:0
    Wed Feb 12 22:23:44 CET 2014: Datasync.Write:executing: /opt/novell/datasync/syncengine/connectors/mobility/cli/enable_setup_4.sh
    Wed Feb 12 22:24:07 CET 2014: Datasync.Write:return code from enable_setup_4.sh:0
    Wed Feb 12 22:24:08 CET 2014: Datasync.Write:executing: python /opt/novell/datasync/syncengine/connectors/mobility/cli/mobility_setup_5.pyc --provision 'ldap' --galuser 'claus' --block false --selfsigned true --path '' --lport '443' --secure true
    Wed Feb 12 22:24:13 CET 2014: Datasync.Write:return code from activesync_setup_5.pyc:1
    Wed Feb 12 22:24:13 CET 2014: Datasync.Write:stdout on error:
    Wed Feb 12 22:24:21 CET 2014: Datasync.GetAllStaticInterfaces:static IP info: ["eth0"]
    Wed Feb 12 22:24:21 CET 2014: Datasync.GetAllipInterfaces:ip is 172.16.0.80
    Wed Feb 12 22:24:22 CET 2014: Datasync.GetAllStaticInterfaces:Mapping of IP addresses and network devices: $["172.16.0.80":"eth0"]
    Wed Feb 12 22:24:22 CET 2014: Datasync.GetIPAddr:First IP address 172.16.0.80
    Wed Feb 12 22:24:22 CET 2014: Datasync.Write:executing: python /opt/novell/datasync/syncengine/connectors/mobility/cli/groupwise_setup_6.pyc --keypath '*****' --lport '4500' --lip '172.16.0.80' --version '802' --soap 192.168.0.4 --key '*****' --sport 7191 --psecure 'no'
    Wed Feb 12 22:24:26 CET 2014: Datasync.Write:return code from groupwise_setup_6.pyc:1
    Wed Feb 12 22:24:26 CET 2014: Datasync.Write:stdout on error:
    Wed Feb 12 22:24:28 CET 2014: Datasync.Write:executing: python /opt/novell/datasync/syncengine/connectors/mobility/cli/start_mobility.pyc
    Wed Feb 12 22:24:41 CET 2014: Datasync.Write:return code from start_mobility.pyc:1
    Wed Feb 12 22:24:41 CET 2014: Datasync.Write:stdout on error:
    Wed Feb 12 22:24:46 CET 2014: Skipping Customer Center Configuration.
    Any ideas?

    Hi,
    returning to this.
    Since last:
    - Got 2.0.1 iso: No change
    - Tried increasing ram: No change
    - Test installed on an alternative vm guest on same subnet as GroupWise server: Succes
    So I guess it must some kind of networking issue:
    - I am installing on a dmz vm guest
    - Checked my firewalls: No packets seems to get blocked
    - Checked the soap interface from my mobility test server http://<groupwise-ip>:7191/soap, which returns POA response as expected
    From install.log:
    Wed Mar 26 21:48:14 CET 2014: Datasync.Write:executing: python /opt/novell/datasync/syncengine/connectors/mobility/cli/mobility_setup_5.pyc --provision 'groupwise' --galuser 'admin' --block false --selfsigned true --path '' --lport '443' --secure true
    Wed Mar 26 21:48:16 CET 2014: Datasync.Write:return code from activesync_setup_5.pyc:1
    Any suggestions?
    What is done is this step 5?
    Originally Posted by konecnya
    In article <[email protected]>, Clausbc wrote:
    > Hi,
    > sorry for being unclear:
    A trick I learned that helps me get better support response as well as
    reducing the number of times I need to use support, is to think through
    what will support (of any kind) need to know to help. Just doing that
    exercise speeds the whole process up.
    > - New install on sles11sp3 x64 virtual guest, 1G of ram
    ouch, that is rather tight and might be low enough to cause you some
    grief. 2GB has worked well enough for small deployments for me, though I
    have had to push up to the official minimum of 4GB once some real load
    got placed on it.
    I would recommend getting that box up to 2GB and try the install again.
    > - Log snip is from install.log in the /var/log/datasync/
    > - GMS never worked on this test install
    > - Haven't found any clues myself in messages
    OK, that helps put a context on things.
    > - Yes SOAP connection is opened, has been verified during wizard at the
    > trusted application step
    Was this run on this Mobility server? If not then do test from this
    Mobility VM. A to make sure the DMZ to LAN route lets it through as well
    as the SLES firewall on the Mobility server.
    Andy of
    KonecnyConsulting.ca in Toronto
    Knowledge Partner
    http://forums.novell.com/member.php/75037-konecnya
    If you find a post helpful and are logged in the Web interface, please
    show your appreciation by clicking on the star below. Thanks!

  • Get return code in command line

    Hi,
    Is possible modify or get return code diferent 0 or 1 when start scenario using command line?

    i use control+M, and result with erros in E$, send to "hospital" whit this

  • V5 How can I get the code from an itunes gifcard that got scraped off

    How can I get the code from an itunes gifcard that got scraped off

    Try Here  >  http://support.apple.com/kb/TS1292
    If no joy...
    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • BR0279E Return code from 'LANG=C dd obs=64k bs=64k if=/oracle/PRD/sapdata1/sr3_1/sr3.data1 of=/dev/rmt0.1': 2

    while i do online backup error in db13 :-
    BR0278E Command output of 'LANG=C dd obs=64k bs=64k if=/oracle/PRD/sapdata1/sr3_1/sr3.data1 of=/dev/rmt0.1':
    dd: /oracle/PRD/sapdata1/sr3_1/sr3.data1: Invalid argument
    BR0280I BRBACKUP time stamp: 2014-06-04 01.00.46
    BR0279E Return code from 'LANG=C dd obs=64k bs=64k if=/oracle/PRD/sapdata1/sr3_1/sr3.data1 of=/dev/rmt0.1': 2
    BR0222E Copying /oracle/PRD/sapdata1/sr3_1/sr3.data1 to/from /dev/rmt0.1 failed due to previous errors
    BR0280I BRBACKUP time stamp: 2014-06-04 01.00.48
    BR0317I 'Alter tablespace PSAPSR3 end backup' successful
    BR0056I End of database backup: benzqjev.ant 2014-06-04 01.00.46
    BR0280I BRBACKUP time stamp: 2014-06-04 01.00.48
    BR0054I BRBACKUP terminated with errors
    attached detailed log

    Hi Mohammed,
    Please change the parameter initSID.sap
    tape_copy_cmd = cpio
    And test the results.
    Regards,
    Deepak Kori

Maybe you are looking for

  • Home Hub 3 Port Forwarding (NOT)

    Hello World Ok recived the New Home Hub 3 today, ahead of my Infinity install. I thought ok lets replace Trusty Home Hub 2 with the 3 as it works both on Std ADSL and Infinity Super Quick UI and love the GIG port BUT and its a BIGGY (well for ME) ! T

  • IPhone or iPad won't connect to Apple TV via Remote App

    I am trying to connect to my ATV2 via the remote app on my iPad2 iOS 5.1.1 and a 3Gs with 5.1.1 and I can not get it to see my ATV2 at all. I have rebooted it and rebooted both the phone and iPad multiple times and it still won't connect. Funny thing

  • Java Program in a package

    Hi Friends, I am trying to compile a program CPTest1.java and CPTest2.java which are in the package G:\com\bofa\pbes\cedrelay i.e(com.bofa.pbes.cedrelay).But these 2 classes are making reference to one more class by name CPTest3.java which is in H:\C

  • How to install Hyperion Essbase 11.1.2.2 Client

    HI Experts, I need to import metadata from essbase cube into OBIEE 11.1.1.6 from Essbase 11.1.2.2 remote server , I got suggestions that I should have installed hyperion essbase 11.1.2.2 client , so can anyone guide me how to install essbase client 1

  • Iomega StorCenter ix2-200 device fails when powered. Best way to retrieve data

    Hi, I'm new here because until now I've been lucky enough to experience no issues with my NAS. Unfortunately, as of this morning when I power on the ix2 the '!' light blinks red. I can't connect to it through my computer and the desktop Iomega progra