Executing a remote command
Hi,
I need to execute some commands on a remote machine. The local machine is a win2K box running weblogic. The remote machine is a UNIX box and it is not running RMI. I have tried using Runtime.getRuntime().exec(cmd) to do this. I tried making calls to telnet, rsh, and rexec for the cmd. In all three cases I was unable to get ahold of the input stream to be able to supply a password.
I have looked at using the de.mud.telnet package but was unable to use it because of a liscencing issue.
Is there another method I should be trying?
Can anyone help?
For details on Runtime.exec: http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
ORO's NetComponents can handle telnet: http://www.savarese.org/oro/software/NetComponents.html
There's also a "java telnet application" in sourceforge: http://sourceforge.net/projects/jta/
Similar Messages
-
How to execute a system command on a remote UNIX server?
I would like to execute a system command (for example "df") on a remote UNIX machine.
A simple example would be welcome...
ThanksI would like to execute a system command (for example
"df") on a remote UNIX machine.
A simple example would be welcome...None will be forthcoming.
Executing a process is relatively simple. However doing this on a remot system is another matter.
See http://sourceforge.net/projects/sshtools/
and/or http://javassh.org/space/start
Other resources to be found with Google. -
Help needed in executing a remote batch file
I need to execute a batch file which is located on a remote machine through my machine. I have no idea to go about with. Please can someone help me out with can be used to execute the remote bat file. I am at present using Runtime.exec() to execute it on my machine.. But i cant use it to execute teh bat file on teh remote machine.Please help
Below is an example server that would run on the remote host. You can connect to it using telnet from DOS prompt, it takes a Y/N to run your command in the cmd variable. I haven't included code for a client as it's really not needed for the example below.
Change the cmd and port variables to what you need. You may need to setup firewall rules to allow your chosen port.
Once it's running, you can test it by using "telnet localhost 1234" on your machine, localhost would obviously become the remote computer's hostname or IP.
I am incredibly new to Java (using the forums to learn bits), so excuse any bad coding practises, I'm sure people will point them out.
Keep in mind that this is totally insecure, so if you're using it on an untrusted network, you may want to look into encryption and providing some kind of password authentication, that, for the moment is out of my league.
Screenshot here.
import java.io.*;
import java.net.*;
class RemoteServer {
public static int port = 1234; // Port to listen on
public static String cmd = "C:\\Test.bat"; // Command to run
public static void main(String[] args)
System.out.println("Waiting for connection...");
try {
/* If you want the server to run forever, uncomment the while
loop */
// while (true)
startServer();
} catch (IOException e) {
e.printStackTrace();
System.exit(1);
/* Starts the server */
private static void startServer() throws IOException
ServerSocket server = null;
Socket client = null;
String input;
try {
server = new ServerSocket(port);
} catch (IOException e) {
System.err.println("Unable to list on port " + port);
System.exit(1); // Can't listen, nothing else to do
try {
client = server.accept();
System.out.println("Client connected... awaiting Y/N");
} catch (IOException e) {
System.err.println("Unable to accept connection.");
System.exit(1);
PrintWriter out = new PrintWriter(client.getOutputStream(), true);
BufferedReader in = new BufferedReader(new InputStreamReader(
client.getInputStream()));
out.println("You are connected, ready to launch command: <y/n>");
while ((input = in.readLine()) != null)
if (input.equalsIgnoreCase("y"))
Runtime rt = Runtime.getRuntime();
rt.exec(cmd);
out.println("Command executed... disconnecting.");
System.out.println("Command executed... disconnecting client.");
break;
} else if (input.equalsIgnoreCase("n")) {
break;
} else {
out.println("Please enter Y/N.");
out.close();
in.close();
client.close();
server.close();
} -
Remote command execution via ssh on ips sensor...
I am attempting to execute a command remotely via ssh so that I can collect the information on another host.
ex: ssh -t username@sensor show tech-support
Instead of the output I expect, I receive an error message: Error: Received invalid command line argument.
Is this type of remote command execution supported by the sensor?
Kevin RigginsNot true, i already created scritp to automaticly backup the IPS
-
I am building an app to run remote commands. A server app with tcp/ip to listen for connections, validate user, then let user send commands(from a predefined list) that will fire the Runtime rt = Runtime.getRuntime() , the Process proc = rt.exec(cmd from cmd list)
Any thoughts on this? Better method or practice?
Can you get static of a proc whil running? I wnat each call to be a new proc, so I guess I could vector them after creation?
Mstrictly network internal ops. Run exe/bat/com on remote server. The commands will be contolled by the admin, so we will be limited. I see the server running as a Win2k service so the permission for it to execute commands could be limited to the user that is the 'log on as' for the service.(is this a correct assumption?)
We have tried rcmd, windows scripting, etc...but they all require admin privs on the target machine and the admins won't allow this.
My thought was to build a command object to extend into commands we are allowed to run. you use a gui to send encrypted command name to server, it decrpyts and runs the appropriate cmd object, firing runtime to execute a predefined cmd string held in the cmd object and permissions based on service 'log on As' user. -
How execute a remote shell script
Hi,
i'm in the instance A and i need to execute a shell script in the instance B.
It's possible?
my db is in 10.2.0.4
tnxdavyp74 wrote:
i'm in the instance A and i need to execute a shell script in the instance B.
It's possible?
my db is in 10.2.0.4Yes. Fairly easy - but there are functionality and security issues that must be considered.
Executing remote shell scripts are the easiest done using ssh and RSA key authentication. On server A, in the oracle user, you need to generate a RSA key for the account using "+ssh-keygen -t rsa+".
A private and public key will be generated in the +/home/oracle/.ssh+ directory. The contents of the public key needs to be copy and pasted into the oracle account on server B, into file +/home/oracle/.ssh/authorized_keys+.
Next you need to accept the signature of server B on server A (thiswill be stored in A in +/home/oracle/.ssh/known_hosts+ ). Simply ssh from A to B using command "+ssh oracle@B+" and accept the signature. The ssh attempt should work and not prompt for a password as RSA authentication is used (server B trust server A and accepts its private key as authentication).
Now you can execute the remote script (fully automated in the background) as follows: ssh oracle@B /software/scripts/foo.sh".
The next step is running this command from within the Oracle instance on A - this can be done using a custom Java stored proc (for accessing the command line) or via +DBMS_SCHEDULER+ as an external program. -
We have the SharePoint Server 2010 with SP1 environment on which the custom SP2010 designer pages were working as expected before the
August 13, 2013 CU has installed. But, getting the below exception while trying to add the new item after the CU has installed.
Error while executing web part: System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.SharePoint.WebControls.SPDataSourceView.ExecuteInsert(IDictionary values) at
System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) 3b64c3a0-48f3-4d4a-af54-d0a2fc4553cc
06/19/2014 16:49:37.65 w3wp.exe (0x1240) 0x1300 SharePoint Foundation
Runtime tkau Unexpected Microsoft.SharePoint.WebPartPages.DataFormWebPartException: The data source control
failed to execute the insert command. 3b64c3a0-48f3-4d4a-af54-d0a2fc4553cc at Microsoft.SharePoint.WebPartPages.DataFormWebPart.InsertCallback(Int32 affectedRecords, Exception ex) at System.Web.UI.DataSourceView.Insert(IDictionary
values, DataSourceViewOperationCallback callback) at Microsoft.SharePoint.WebPartPages.DataFormWebPart.FlatCommit() at Microsoft.SharePoint.WebPartPages.DataFormWebPart.HandleOnSave(Object sender, EventArgs e)
at Microsoft.SharePoint.WebPartPages.DataFormWebPart.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean
inclu... 3b64c3a0-48f3-4d4a-af54-d0a2fc4553cc
06/19/2014 16:49:37.65* w3wp.exe (0x1240) 0x1300 SharePoint Foundation
Runtime tkau Unexpected ...deStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 3b64c3a0-48f3-4d4a-af54-d0a2fc4553cc
I have tried changing the "DataSourceMode" as below, now the insert command is working, but update command is not working.
<SharePoint:SPDataSource runat="server" DataSourceMode="ListItem" />
Also, the lookup dropdown fields are displaying the value as "<a href="Daughterhttp://cpsp10/sites/Employees/_layouts/listform.aspx?PageType=4&ListId={8F62F444-FB6A-4F03-9522-C4696B45DCD1}&ID=10&RootFolder=*">Daughter</a>"
instead of only "Daughter".
Please provide the solution to get rid of this issue.
Thanks
RamasubbuTry below:
http://social.technet.microsoft.com/Forums/en-US/ae910269-3a0c-4506-844b-e8bc89d95b71/data-source-control-failed-to-execute-the-insert-command
http://blog.jussipalo.com/2012/01/sharepoint-2010-data-source-control.html
While there can be many causes for this generic error message, in my case the first parameter or ddwrt:DataBind function inside the SharePoint:FormFields element was
'i' and I was working with an Edit Form. Changing it to
'u' as it was with every other FormField fixed the issue.
<SharePoint:FormField runat="server" id="ff1{$Pos}" ControlMode="Edit" FieldName="Esittaja" __designer:bind="{ddwrt:DataBind('u',concat('ff1',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Esittaja')}"
/>
Explanation:
DataBind operation type parameters (the first parameter) are listed below:
'i' stands for INSERT,
'u' stands for UPDATE,
'd' stands for DELETE.
http://webcache.googleusercontent.com/search?q=cache:d9HHY4I7omgJ:thearkfloats.blogspot.com/2014/03/sharepoint-2010-data-source-control.html+&cd=4&hl=en&ct=clnk&gl=in
If this helped you resolve your issue, please mark it Answered -
How to Execute a Remote Procedure in Portal using Database Link
Hi,
I followed the instructions to create a Portal form for a remote procedure. But I am encountering the following error. Can someone advise what may be the cause?
Failed to execute - Missing string(create_package_body) language(us) domain (wwv) sub_domain (wwv_builder) (WWV-04300)
ORA-04020: deadlock detected while trying to lock object PUBLIC.PORTLET_SCHEMA (WWV-11230)
Failed to parse as PORTAL - (WWV-08300)
PURPOSE
How to execute a remote procedure in Portal using Database Link.
DESCRIPTION
This procedure assumes that you have two databases, one of which is remote, and Portal is configured in the other.
Remote Database A:
==================
1) Create a procedure as follows: Create or Replace PROCEDURE SCOTT.ADD_TWO_VALUES ( v_one IN NUMBER, v_two IN NUMBER, v_result OUT NUMBER) as begin v_result :=v_one+v_two; end; 2) Grant execute privileges to PUBLIC on the procedure.
Database B (where Portal is configured): ========================================
1) Create a public database link and choose to connect as a specific user (say SYSTEM). By default, in an Oracle 8i database, the "global_names" parameter in initSID.ora (or init.ora) file is set to "true". This Global Naming parameter enforces that a dblink has the same name as the database it connects to. Therefore, if the remote global database (A) name is "ora8.acme.com" then the database link should also be named as "ora8.acme.com".
2) Create a synonym for the procedure in Database A. Make sure you fully qualify the procedure name in the remote database (like SCOTT.ADD_TWO_VALUES).
3) Create a dynamic page to execute the procedure. The ORACLE tags in the dynamic page will look similar to the following: <ORACLE> DECLARE v_total NUMBER; BEGIN ADD_TWO_VALUES(:v_one,:v_two, v_total); htp.p('The total is => '); htp.p('<input type="TEXT" VALUE='||v_total||'>'); htp.para; htp.anchor('http://<machine.domain:port#>/pls/portal30/SCOTT.DYN_ADD_TWO_VALUES.show_parms', 'Re-Execute Procedure'); END; </ORACLE>
4) Portal does not have an option to create a form based on a synonym. Therefore, if you want to create a form instead of a dynamic page, create a wrapper procedure and then create a form based on this procedure. For example: Create or Replace PROCEDURE PORTAL30.ADD_TWO_VALUES_PR ( v_one IN NUMBER, v_two IN NUMBER, v_total OUT NUMBER) as begin add_two_values(v_one, v_two, v_total); end;
5) Grant execute privileges to PUBLIC on the procedure.hello...
any input will welcomed... Thanks.. -
We are trying to implement a process so that any document that needs to be printed through our Java application will be printed as PDF using Adobe Reader. For which, We created and execute the below command line to call Adobe Reader and print the PDF on a printer."C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" /T "\\<Application Server>\Report\<TEST.PDF>" "<Printer Name>". Current Situation: The above command line parameter when executed is working as expected in a User's Workspace. When executed in a command line on the Application Server is working as expected. But, the same is not working while executing it from Deployed environment.Software being used: 1. Adobe 11.0 enterprise version. 2. Webshpere Application Server 8.5.5.2. Please let us know if there is a way to enable trace logs in Adobe Reader to further diagnose this issue.
This is the Acrobat.com forum. Your question will have a much better chance being addressed in the Acrobat SDK forum.
-
Issue while executing the discovery command from target nodes
Hi Experts.
I had to create cluster two node using openfile, after creation of successful lun and associated partition from all the nodes i have changed the ip address of openfiler.
After changing the IP on open filer.
A) openfile version:-
[root@san ~]# uname -r
2.6.26.8-1.0.11.smp.pae.gcc3.4.x86.i686
B) Linux Oel5:-
[root@rac1 ~]# uname -r
2.6.18-194.el5xen
[root@rac1 ~]#
1:- I am able to ping and ssh etc from any node to openfiler.
However, while executing the below command i am facing the below exception..
service iscsi restart
Stopping iSCSI daemon:
iscsid dead but pid file exists [ OK ]
Starting iSCSI daemon: [ OK ]
[ OK ]
Setting up iSCSI targets: iscsiadm: No records found!
[ OK ]
[root@rac1 ~]#
Moreover, tried to discover the targets, unfortunately no message is getting displayed after execution of this below command.
[root@rac1 ~]# iscsiadm -m discovery -t sendtargets -p 192.168.37.200
[root@rac1 ~]#
The quick response will be appreciated as my whole test case is down as of now due storage issues.
Thanks,
Arch.Are you running a firewall that needs to be adjusted to support your changed Openfiler IP network?
-
Executing an OS command !!
Hi
Have anyone tried executing an OS command in UNIX(AIX) with SP12 File/FTP adapter ?
We have created a shell script , ve given execute permissions for all(chmod 777) and tried executing it using file adapter , but we dont see it working.
Ve referred to the weblog & few forum threads, but could'nt get to work
checked an SAP note , but all it talks abt is the way the implementation has been changed from SP13 . Does this mean it never works in SP12 ? pls let know
Regards
SaravanaHi Saravan,
You can try writing a log to another file for each command in your shell script. Atleast you would know why exactly the command is failing.
Something similar to this inside your script itself..
/people/michal.krawczyk2/blog/2005/08/17/xi-operation-system-command--error-catching
Regards
Anand -
How to execute a Unix Command in java
Hi, Iam trying to execute a unix command on Sun Solaris by passing that command to a java program. How can I achieve this?
Thanks in advance.Have a look at the javadoc around the Runtime.exec() method. If the command is a shell command then you might have to execute a shell as well as the command.
For example, if you wanted to run a unix command 'ls -l > output.txt' the you might have to pass the following string into the exec() method,
"/bin/sh ls -l > output.txt' -
Executing a SQL Command in my bean class
Hello everyone,
I'm using JDeveloper 12.1.2.0.0.
I have an interest in executing a query in my bean method. I've done some research and i still got a code but it can't find the method that the method requires so i tried to added the query in my AppModule and i've added my method as a data control but how can i access it and modify it in my bean method?
The page with the code that doesn't find the method: http://jjzheng.blogspot.pt/2010/11/run-single-query-in-application-module.html
Which gives me: "Method 'getDBTransaction' not found"
The page that creates my method as a data control: http://amit-adf-work.blogspot.pt/2013/09/how-to-execute-sql-using-adf-application.html
Is any of this the right way? How can i execute a SQL Command in my bean class?
Regards,
Frederico.This is the code I use
// GET A METHOD FROM PAGEDEF AND EXECUTE IT
// get the binding containe
BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
// get an Action or MethodAction
OperationBinding method = bindings.getOperationBinding("YourMethodAction");
// if there are parameters to set...
Map paramsMap = method.getParamsMap();
paramsMap.put("param","value") ;
// execute the method
method.execute();
List errors = method.getErrors();
if (!errors.isEmpty())
// handle errors here errors is a list of exceptions!
// no error resume normal work
Timo -
Satellite A500-14L: Supervisor Password Utility & Remote Command Manager
Hi,
I just installed Windows 7 Home Premium *x64* on my A500-14L (PSAM3E-02N008FR) and all went smooth, even the TVAP and flashcards install. Unfortunately, I have a problem with the following utilities (latest versions found on Toshiba website) :
- Supervisor Password Utility
- Remote Command Manager
I installed both of them but I can't find them in my start menu!
There is no install error but it's like they are not installed at all.
Can someone please help me on this matter ? Thanks in advance.
AramysHi
For Supervisor Password Utility I recommend checking the Toshiba Assist.
In Secure you should see the Supervisor Password Utility.
The Remote Control Manager improves the support for a remote control on your computer.
Im not sure if you could access this application but if yes then you should check it in control panel. -
An error occurred when executing a REMOTE FUNCTION CALL.
Dear all,
We have two syetms called DXD and GRD , we have a remote enabled function module in the DXD system , when i am trying to call this Function module from
GRD system it is going for the short dump, and giving the follwing error,
<b>Error analysis
An error occurred when executing a REMOTE FUNCTION CALL.
It was logged under the name "RFC_NO_AUTHORITY"
on the called page.</b>
But i do have the access for the DXD system also, i am really struggling to solve this problem, if any lights are there to help me , i will be thank full for then,
some body suggested for me that we need to maintain the Trusted system tables in the target system.
Thanks & regards
Satya.first u( user id ) have to get the Authorizations to use RFC ?
object will be like S_RFC or some thing like this.
when u get this kind of error just call /NSU53 then u will come to know which Authorization Object is missing from ur User Profile.
Regards
Prabhu
Maybe you are looking for
-
Error message on startup and shutdown
When I start the system I receive a message that says "[ 0.00000] tsc: Fast TSC calibration failed /dev/sda1: clean, 122821/1831424 files, 873225/7323624 blocks [ 6.345621] b43-phy0 ERROR: Firmware file "b43/ucode15.fw" not found [
-
Hello. I am trying to change the colors on my ical. I have been able to select a calendar group, click "get info" and then "other" in the color options and which point a a lot of color options are available. HOWEVER, I can't seem to select the color.
-
Upgrading from an iPod Video to an iPod Touch
I was just wondering if there is a way to possibly trade in my ipod video and so that I get a bit of a discount on the ipod touch? Do I have to do this through the apple store or the best buy where i originally bought my video?
-
Backing Up ipod (20 GB)
I have a 20 gb ipod 4th gen, i have about 1,200 songs on it and have never and have no future using it as a hard drive to transfer documents, etc. My problem is, is this: I want to backup my files or move every song back into itunes beacuse ive heard
-
Planning activity price in various currency
Hi, I have controlling area with currency EUR and two company code linked to it: Company code A with currency EUR Company code B with currency MXN Is there any way to plan activity price in USD? Thanks in advance Regards