Execute a script on a remote machine - possible?

I am sorry if this sounds silly - what I would like to know is if its possible for a java program executing on one machine to execute a shell script that resides on another machine.
That script in turn invokes a java program which does some other stuff.
I know the way to do it would be to eliminate the script altogether and have the java program on the other box listen on a port and have it accept connections from the host machine. But a client is insistent he doesnt want it that way and I am not even sure if its possible to do as he says. I am aware that I can use the Runtime and Process classes to invoke a script on the same machine that the java application executes on, but is it possible to invoke a script on another machine?
Thanks,
Ram.

If they're running the server on a *NIX box, you might check into inetd or xinetd - this is basically a proxy that listens on a certain port, starts a process running when it gets a request on that port, hands the request to that process, and then the process exits while xinetd waits for the next request.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Execute a script in a Linux machine from a Java application

    Hi,
    I am trying to execute a script in a Linux machine from a Java application on a Windows environment. My code is
    commande="rsh 185.30.30.30 -l goku /newfolder/bench/bin/Agent start ";
    try{
    Process process = Runtime.getRuntime().exec(commande);
    catch(Throwable t){}
    It works fine but the script takes too much time to start (almost 3 minutes). My question is there exists anther way to execute the script, another command? I have already tried ssh but windows doesn�t recognize it
    If somebody has any idea please let me know...
    Thanks

    The script starts and stops a process (Agent) so it doesn�t take too much time to execute itself. It is when I execute the script from my java program that i must wait to watch my process running in my Linux server.

  • Best method to execute a command on a remote machine?

    I am currently using runtime.exec to execute commands on the machine where my java gui is running. What I would like to do is to execute the programs on a remote networked machine.
    What should I be looking at? creating sockets, using rmi?
    eventually it would be good to utilise ssh for the connection.
    Any help is much appreciated.

    haven't really looked at this properly, was really after some advice on what methods would be useful.....
    I can see that a telnet type solution can work... need to look further at rmi i think

  • How to run a PS script on a remote machine

    Hi,
    I have a script located on a remote machine at c:\Temp\Script1.ps1  I want to run this script remotely from a driver system.  Via Powershell remoting on the driver machine, I run the following:
    $cred = Get-Credential Domain1\User1
    $Sessid = New-Pssession DC1
    Invoke-Command -session $sessid -cred $cred -ScriptBlock {c:\temp\Script1.ps1}
    I get an error 'Invoke-Command : Parameter set cannot be resolved using the specified named parameters.
    I see the Session ID created and opened fine and the script runs fine on its own on the remote machine.
    Any suggestions as to how to resolve the error
    Thanks for your help! SdeDot

    You don't say what the client machine is, but if it is a windows PC you could use the TEXT_IO package that comes as part of Oracle Forms or procedure builder. Alternatively you could use the client version of SQL*Loader. If neither of these options are feasible, why not just copy the file on to the server and use UTL_FILE, SQL*Loader, or define an extrnal table?
    Regards,
    Steve Rooney

  • Executing PowerShell scripts on a remote host

    I need to execute a PopwerShell script on a remote host (i.e. to add or remove Windows features).
    The script uses some Powershell commands to be executed on the remote host (i.e. to add or remove Windows features).
    I made part of the job but I am unable to go on...
    After enabling PSremoting on the target host I run a script with the following commands:
    winrm s winrm/config/client '@{TrustedHosts="remoteserver"}'
    $mysession = new-pssession -computername remoteserver -credential remotedomain\remoteuser
    If I enter the above lines interactiverly I can go on interactively by entering:
    Enter-PSSession $mysession
    and execute all the PowerShell commands I need.
    My problem is that everything must be part of a script.
    I attempted using "Invoke-command" with no success: maybe there is a syntax error or it is not the right command to be used in a script.
    Can anybody please provede a sample of a script containing PowerShell commands to be executed on the remore host?
    Regards
    marius

    You're on the right track.  You can use Invoke-Command with the same credentials (or PSSession from New-PSSession, if you prefer) to execute code remotely.  The tricky thing, unfortunately, will be the credentials.  Right now you're being
    prompted to enter a username and password, but in an unattended script, you'd need to have these credentials saved somehow.  That can open up a can of worms, depending on your requirements.
    The simplest way to do this is to hard-code the password in your script.  No one on the planet recomments actually doing this, because well, you've just exposed an admin password to the world.
    The safest way to do this is to log on as the same account that will be used to run the script, on the same computer where the script will be run, and enter the credentials once manually, and export them to an XML file.  With this approach, the credentials
    in the XML file will be encrypted with the Windows Data Protection API (DPAPI), and the keys necessary to decrypt that data are only available to the current user, on the current computer.
    If you need to be able to securely save the data and have it read by other users, or on other computers, things start to get more complicated.
    Here's an example of the DPAPI approach:
    # to create the credential file
    $cred = Get-Credential
    $cred | Export-Clixml -Path c:\myEncryptedCreds.xml
    # to use it later (on the same computer, by the same user)
    $cred = Import-Clixml -Path c:\myEncryptedCreds.xml
    Invoke-Command -ComputerName SomeComputer -Credential $cred -ScriptBlock {
    Do-Something

  • Execute .sql scripts from a remote login

    Hello,
    1) How do I execute a remote sql script from sqlplus?
    SQL>@remote_server:$HOME/test_sql.sql ...this did not work, which would work?
    2) Another question, in sqlplus I can do...! echo testing123>$HOME/test123.txt.
    How do I do this within a store procedure?
    This does not work, which would work?
    declare
    v_test varchar2(300) := '! echo testing123>$HOME/test123.txt';
    begin
    execute immediate v_test;
    end;
    /

    Re Q2.
    I take it that's an sqlplus feature on unix as it doesn't work on windows:
    SQL> ! echo testing123>$HOME/test123.txt
    SP2-0734: unknown command beginning "! echo tes..." - rest of line ignored.
    SQL>Also the reason this isn't working from within PL/SQL is that the execute immediate statement is used to send SQL statements to the SQL engine. What you are attempting to do is to send sqlplus commands to the SQL engine which obviously knows nothing about sqlplus commands. Those commands are very specific to the sqlplus executable and will only work in that environment.
    ;)

  • Forms6: Execute program in remote machine?

    Hi,
    I'm trying to execute a program in a remote machine. For exemple: I can use the function 'host ('notepad')' and the notepad executes in the machine running the .fmx. How can I execute a command in a remote machine running Unix? Is there a function?
    I'm using Developer6 (forms).
    Thanks.

    You should be able to use <cfexecute...> to do this,
    you will have to
    make sure all the connections and permissions are set up.
    Just remember that by default, at least on windows systems,
    CF is
    configured to only have access and permissions to the local
    system, you
    will need to modify this if it has not been done.

  • Update-Help error when console application is run in remote machine via PS remoting

    Hello,
    When I execute a particular console application in a remote machine via PS remoting, I get an error related to update-help. When I execute it directly on the remote machine, it works...
    My code:
    $credential = Get-Credential -Credential "DomainName\AccountName"
    $session = New-PSSession -ComputerName "MachineName" -Authentication Credssp -Credential $credential;
    Invoke-Command -session $session -ScriptBlock {
    try{
    cd <network share location>
    .\theConsoleApp.exe | Out-File C:\console-output.txt
    $error | Out-File C:\console-error-output.txt
    $exitCode
    } catch {
    throw $error
    Error seen in the console:
    NetNat, PcsvDevice, PSDesiredStateConfiguration, SoftwareInventoryLogging, StartScreen, TLS, WindowsSearch' with UI culture(s) {en-US} : Unable to retrieve the HelpInfo XML file for
    UI culture en-US. Make sure the HelpInfoUri property in the module manifest is valid or check your network connection and then try the command again.
    $error variable from above:
    Errored out (exit code 1603) with error message: ErrorId 10010: Xpatch threw an unexpected exception: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
    I’ve tried
    two different user accounts
    multiple file share locations
    different OSs
    different target servers
    but have not determined the cause of the error.
    I would appreciate any help on this.
    -Rohan.

    Clearly the remote EXE cannot run in that context.  YOU should not run that program remotely.
    I suspect there is also information you are not giving to us.
    ¯\_(ツ)_/¯

  • Linked server problem, its works locally but not from remote machine

    Hi,
    i am using the application NAV and have written the query in the application. am using automation variable to link to the SQL Server.
    The problem is that , the query which i have written executes only when i am working on local machine .
    I mean when i want to execute the same query from remote machine through my app Dynamics NAV then its not getting executed.
    Thanks in advance

    Depends on what you are trying to do and what security you are using.
    What error did you get?
    If you are using windows authentication then take a look at delegation
    http://www.databasejournal.com/features/mssql/article.php/3696506/Setting-Up-Delegation-for-Linked-Servers.htm
    Regards, Ashwin Menon My Blog - http:\\sqllearnings.com

  • How to execute a shell script which is present in remote machine using ODI

    I have requirement of executing a batch (shell script) which is present in the remote machine.
    i have an ODI agent in remote machine as well. I have created agent locally by using the remote machine IP and port.
    I am able to test the agent successfully. But when i am executing the package using that agent it is failing with the following error
    errorODI-1226: Step Execution of the Scenario REMOTE_DEMO version 001 fails after 1 attempt(s).
    ODI-1241: Oracle Data Integrator tool execution fails.
    Caused By: oracle.odi.runtime.agent.invocation.InvocationException: HTTP/1.1 500 ODI-1423: Warning connecting to Agent localagent: work repository WORKREP1 is not bound to the master
    My Work Repository Name is : WORKREP1
    Remote Work Repository Name is:WORKREP_LOCAL.
    Could anyone please help me regarding this.
    I can't download shell script and run it locally this needs to be run on that remote machine only.
    Thanks
    senthilkumar

    This is the code.
    1. we can declare types dynamically
    2. Internal table dynamically
    3. Select querry dynamically
    just copy paste this code
    Here is the code for your question
    DATA:v_fieldname
    TYPE fieldname,
    l_PROG TYPE string,
    v_mess TYPE string,
    l_sid TYPE string,
    wa_ddfields TYPE dntab.
    DATA i_tab TYPE STANDARD TABLE OF string.
    DATA:l_str TYPE string,
    l_str1 TYPE string.
    PARAMETERS matnr type marc-matnr.
    end-of-SELECTION.
    *build the subroutine pool
    APPEND 'PROGRAM subpool.' TO i_tab.
    APPEND `LOAD-OF-PROGRAM.` TO i_tab.
    APPEND `DATA i_tab1 TYPE TABLE OF vbak.`      TO i_tab.
    APPEND `DATA l_rows TYPE i.`      TO i_tab.
    APPEND `select * into table i_tab1 from vbak.` To i_tab.
    append 'DESCRIBE TABLE i_tab1 LINES l_rows.' to i_tab.
    append 'Write :  l_rows .' to i_tab.
    GENERATE SUBROUTINE POOL i_tab NAME l_PROG
    MESSAGE v_mess
    SHORTDUMP-ID l_sid.
    IF sy-subrc = 0.
    PERFORM ('LOOP_AT_TAB') IN PROGRAM (l_PROG) IF FOUND.
    ELSEIF sy-subrc = 4.
    MESSAGE v_mess TYPE 'I'.
    ELSEIF sy-subrc = 8.
    MESSAGE l_sid TYPE 'I'.
    ENDIF.
    Edited by: vijay wankhade on Jan 1, 2009 5:34 PM
    Edited by: vijay wankhade on Jan 1, 2009 5:34 PM

  • How to execute vb script with out using Remote manager in oim 11g r2

    Hi Currently,
    i have a requirement to execute  vb script (present on a remote machine in which connector server is installed) from oim machine while using Exchange connector (11.1.1.6).
    This can be achieved by using remote manager,but i dont want to use remote manager.
    Hence decided to use Action scripts.
    As per connector configuration,
    i have configured Action scripts in Lookup.Exchange.UM.Configuration lookup definition, by means of three entries
    After Create Action Language      Shell
    After Create Action Target           Resource
    After Create Action File              /home/scripts/Disable.bat
    Disable.bat has the following ,
    Powershell.exe -File C:\scripts\Setup.vbs
    -%Log on Name%
      Exit
    As Setup.vbs is expecting a parameter of log on name, i was providing the same.
    But while creating the user,as this script gets called, getting the following error and hence 'create User' is getting failed.
    Problem while PowerShell execution System.Management.Automation.RemoteException: This task does not support recipients of this type. The specified recipient XXXXXXXXXXX...XXXXX is of type UserMailbox. Please make sure that this recipient matches the required recipient type for this task.
    While provisioning the user to Exchange , i have selected 'Recepient type' as 'User Mail box' explicitly, but still getting the error.
    Please provide any pointers to resolve the issue.
    Thanks in advance
    Kumar

    As far as I know Oracle and MySQL are two different products.
    Why do you clutter an Oracle forum with MySQL questions?
    If MySQL is such a tremendous RDBMS, like many people state (as 'free' means per definition better),
    why don't you visit a MySQL forum where fellow MySQL aficionados can answer you MySQL questions?
    In short, why don't you stop abusing Oracle forums?
    Sybrand Bakker
    Senior Oracle DBA

  • How to test oracle is up and running in remote machine using shell script

    Hello,
    I need help to write an linux script.
    I have a java application server running on machine 192.168.5.20 and our oracle 10g standard 1.0.2 is running on machine 192.168.5.21.
    I have found script to start oracle when computer is turned on.
    But I cannot start my application server automatically since it depends on whether oracle is up and running or not on the remote machine.
    Therefore, in case of power failure or maintenance, our client has to call us to start application server.
    I would be grateful if someone can help me "How can I write script to check oracle is up and running in machine 192.168.5.21 from machine 192.168.5.20.
    For your information, I have no oracle installed in application server. So tnsping won't work.
    What I want is when power is back, application server script automatically and tesing for oracle server is up and running. If it is up, script will start application server.
    Thanking you.

    Hi,
    It's not failover or experimental. My application server uses JBOSS and JBOSS needs database name to start up. My enviroment is LAN. My database is in different machine as I mentioned before. So In case of power failure, I need to start my application server (JBoss) manually, because I need to confirm that oracle is already running before start app server.
    I want an automated script (when power is just on) to start my application server which will wait to check if the datbase server is up I will start application server.
    The scripts given above It works if appserver and db server in the same machine (my development machine).
    But when I test the script in my production applicaiton server, It shows sqlplus command not found (my app server does not have any oracle client installed).
    About hostname yes My applicaiton server hostname is hostapp1 and dabase server hostname is hostdat1.
    Do you think Is it possible to test the script without oracle client not installed. or It has to be done writing code like java program and test using jdbc connection.
    Best regards.

  • How to use URL class to execute a java class/app  on a remote machine?

    I am a beginner in Java networking and have a question about URL programming.
    How do I pass parameters to a java class/application over the web and then cause it to execute ? I then want to get the result back from the clas/app. The class/app resides on a remote machine and the protocol used is "http" protocol. OR all this is not possible through the URL and related classes ?

    How do I pass parameters to a java class/application over the web and then cause it to execute ? Using the HTTP protocl you can either perform a GET where the parameters are in the URL or a POST where the data is sent to the server with the request.
    The server must be setup as a web server to execute code based ojn a HTTP request. Using a web server with a JSP which contains the code to execute is the simplest way to do this.
    I then want to get the result back from the clas/app. The output of the JSP becomes in the data returned by the HTTP request.
    I would suggest looking for example on google.
    http://www.google.co.uk/search?q=java+http+request+tutorial
    Another option is to use RMI. The integration is tighter but it does not use the HTTP protocol.

  • How to excute a power shell script to remote machine using power shell script folder path and script name

    Hi,
    Let say, I have 3 parameters.
    1. Script FolderPath (Remote path for e.g \\RD101\ScriptSharedFolder     Here RD101 is one server)
    2. Script Name(StopAllService.ps1)
    3. Server Name (RD45)
    I want to execute a powershell scritp in my local machine(Test1)  and in that script I want to pass the above three parameters.Now I want to excute the StopAllService.ps1 script into RD45 server. But the script is available in RD101 machine.
    So What I want to here How can we do this ? I have script name and script folder path and target execution server name.
    Pls giude me or give me the script.
    By
    A Path Finder..
    JoSwa 
    If a post answers your question, please click &quot;Mark As Answer&quot; on that post and &quot;Mark as Helpful&quot;
    Best Online Journal

    Hi,
    You got 2 solutions for your problem:
    1- If you have permission to run scripts in the remote computer without specifying your credential,
    then, the first reply solve your problem.
    2- If you have permission to run scripts in the remote computer
    having to specify your credential, l then,
    my solution solves your problem.
    If the remote computer requires signed scripts only, you need signed script. Period. Or are you trying to break remote computer security?
    If you need signed script, there's no psdrive that'll circumvent such requirement.
    The problem is that the execution policy is set to "RemoteSigned". Using the URL explicitly tags that script as being from a remote source, and the policy blocks it.  The PSDrive provides a local reference for the script.  It does not
    sign the script but the local drive reference may prevent it from being blocked for being from a remote source. I'll test that later.
    Script signing is not and should never be considered a security measure. It is easily circumvented by running the script using powershell.exe, and using the -ExecutionPolicy parameter to override whatever the local execution policy setting is. 
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • Need help on Executing this Script to update LyncDatabase remotely

    Hi All,
             I have some problem with executing the below script (to update the LyncDB post CU4 patched on Lync Servers) remotely, but it works fine Locally(from any Lync FE machine),
    Script: Install-CsDatabase -Update -ConfiguredDatabases -SqlServerFqdn "LyncDB.Julie.local" -UseDefaultSqlPaths
    When executing locally from any Lync FE Machine(LyncFE.julie.local), its working fine "Piece of Output for your reference"
    Output:
    PS C:\Users\julie> 
    Install-CsDatabase -Update -ConfiguredDatabases -SqlServerFqdn "LyncDB.Julie.local" -UseDefaultSqlPaths
    ****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.BlobStore'****
    Trying to connect to Sql Server LyncDB.Julie.local. using windows authentication...
    Sql version: Major: 11, Minor: 0, Build 3128.
    Sql version is acceptable.
    Checking state for database rtcxds. it use to go like this for few pages to update all 06 database
    Remote Script:
    $sessionoption=new-pssessionoption -SkipRevocationCheck
    $password=ConvertTo-SecureString -String "*******" -AsPlainText -Force
    $credential=New-Object System.Management.Automation.PSCredential("******", $password)
    $session=New-pssession -ComputerName "LyncFE.julie.local" -port 5985 -Credential $credential -Authentication
    Negotiate -SessionOption $sessionoption
    Try{
    $cmd=invoke-command -session $session -scriptblock{
    Install-CsDatabase -Update -ConfiguredDatabases -SqlServerFqdn "LyncDB.Julie.local" -UseDefaultSqlPaths
    Write-Host $cmd
    Remove-PSSession -Session $Session;
    Catch
      $RetVal = "Error23: " + $error[0].Exception.toString()
    $cmd
    Error:
    Output:
    WARNING: Install-CsDatabase failed.
    WARNING: Detailed results can be found at "C:\Users\Julie\AppData\Local\Temp\Install-CsDatabase-52517af7-39ea-482e-8ba6-166a15cf8
    4d2.html".
    Command setup failed: Active Directory error "-2147016672" occurred while searching for domain
    controllers in domain 
    "ad.*****.com": "An operations error occurred.
        + CategoryInfo          : InvalidOperation: (:) [Install-CsDatabase],
    ADTransientException
        + FullyQualifiedErrorId : BeginProcessingFailed,Microsoft.Rtc.Management.Deployment.InstallDatabaseCmdlet
        + PSComputerName        : LyncDB.Julie.local.com

    I tried both the Option, both still I'm getting the same error like the below,
    Error:
    Output:
    WARNING: Install-CsDatabase failed.
    WARNING: Detailed results can be found at
    "C:\Users\Julie\AppData\Local\Temp\Install-CsDatabase-52517af7-39ea-482e-8ba6-166a15cf8
    4d2.html".
    Command setup failed: Active Directory error
    "-2147016672" occurred while searching for domain controllers in domain 
    "ad.*****.com": "An operations error occurred.
        + CategoryInfo    
         : InvalidOperation: (:) [Install-CsDatabase], ADTransientException
        + FullyQualifiedErrorId : BeginProcessingFailed,Microsoft.Rtc.Management.Deployment.InstallDatabaseCmdlet
        + PSComputerName    
       : LyncDB.Julie.local.com

Maybe you are looking for

  • To Capture Excise Duties for Customer Material

    Dear All, Issue is regarding to capture excise invoice for Customer Material. 1. one of our client receives Customer material which should not be reflected in stock. 2. Excise should be captured which receiving 3. Now when this Customer material is r

  • Is there a way to get my music from my old library (crashed computer) on my new computer so I can sync that librabry with my new purchases?

    Is there a way to get my music from my old library which is located on a crashed computer - to my new computer so I can sync that librabry with my new purchases?

  • SQL Developer problem viewing tables

    When I connect to a particular database at work I cannot see the tables under a schema I have access to. I know that my permissions are correct because i can connect to the same db with Enterprise Manager Console and i can see the tables under the pa

  • Require Doc Formats Related to Integration

    Hai All,   I want prepare Functional and Technical spec. So that I require some documents formats like Scope,Functional Speficiation , Technical Specificatiosn or any documents related to Integration using XI. If you people send to this id [email pro

  • Problems with iTunes shortcut

    I'm having a problem with the iTunes shortcut, I pin it to my taskbar but all I get is this: http://i38.tinypic.com/bdmmhi.png The iTunes shortcut looks like it hasn't been booted, right? But thing is, it has, it's just that the actual iTunes-process