Installing Software via SSHJ results in exit code 127 - java

I am trying to write a software to automatically install Linpack on a CentOS Server.
Here's the code I've been working with so far
First, I upload 2 zip files to the SFTP Server that's running on CentOS, which works fine.
Then I extract those 2 files using the commands tar xfv l_mklb_p_2020.2.001.tgz and tar xfv l_mpi_2019.8.254.tgz which also work as intended.
Then I try to cd l_mpi_2019.8.254 into the extracted folder to execute ./install.sh
However, this is where my program fails. I get the exit code 127, which would imply that the command does not exist/can't be found
Executing these commands in the same order manually over PuTTy works just fine though, so I am unsure why it isn't working in my program. Maybe the / gets escaped so the command that's executed is .//install.sh? How would I check for that though? Does anyone have any ideas?

Related

Batch File to silently auto-install Java

I am writing a Batch to auto-install Modded Minecraft (included everything needed). Installing Java seemed simple enough but I can't figure out how to install it silently with something like wget.
Example:
wget {java download link}
/s java-installer.exe (basically run it silently)
then wait for it to install (which I also can't find a good way)
if exist "java.exe" (goto java-installed) else (goto java-install-failed)
then on to the rest of my code
(Any answers are appreciated)
I tried to install java from the installer file in the batch but it just opens the file. I don't really know where to go from there. The ideal process would silently installed it and output the info from the java installer to the same command prompt window and the batch file

run a jarfile in a different machine from an sqlserver/issue a terminal command from an sqlserver to another windows machine

I have a series of stored procedures(say, SP1, SP2, SP3) consecutively running on an sqlserver(say, serverA).
After SP3 finishes execution, I want to run a jar file in some machine (say, computerA). Is there a way for me to trigger the run of my jar file in computerA after SP3 finishes executing in serverA?
Note: I can only run my jar file in computerA because my jar file actually retrieves data from Bloomberg API. So, this jar file needs to run in a machine that has Bloomberg terminal on it. Only computerA has a Bloomberg terminal.
I think another way of saying this is how to issue a terminal command from an sqlserver to another windows machine. Because I can just issue the following command to computerA but I really don't know how to make that possible.
java -jar D:\Runnables\myJavaApp.jar

Run shell script from Java to send data via USB

Exactly as specified in the title, I'm trying to send data to my ODROID-Show external screen via USB. I'm running a shell script that sends such data. The problem is I can simply run the command through Terminal and it runs successfully and data is sent to my little screen through USB port. When I try to run the same command via Java, Nothing happens.
Process proc = Runtime.getRuntime().exec("/bin/bash -c /home/ahmed/ODROID-SHOW-master/example/linux/images.sh /");
The specified command should have root privileges to run. That, I've switched to root then ran the code and nothing happened. Any thoughts how to solve such problem?
Edit:
IF you can show a code that executes given command prefixed by sudo this will absolutely work.
I was able to run the program as root. but, corrupted data are sent to ODROIDscreen rather than valid images. while it transfers successfully when ran through Terminal, Any thoughts why that happens?
I would check if the script executed by the bash interpreter requires certain environment variables set before execution.
I'd add a debug line in the executed shell script to dump the environment like "env > my_dump_env.txt" then run the script both from command line as well as from Java and do a diff see what is missing or is different.

Maven builds in Jenkins failing, succeeding on command line

We are customizing the site generation in maven and one of the things that it does is call Visio to have it translate some charts into png. We use a vbs script which calls Visio and that is called from a java class by calling Process proc = Runtime.getRuntime().exec(command); where command is cmd /c "cd "C:\Path\To\Module\site\target\staging"&&exportVisioSvg.vbs "C:\Path\To\inFile.vsd" "C:\Path\To\outFile.png""
Now this code executes on my own machine just fine. Visio is called up and generates a file. When I run it on the server hosting our Jenkins instance it works as well. When I run the command by itself it works just fine. Finally when I goto the Jenkins\workspace and execute the maven build there it works just fine.
However when I run the build in jenkins with exactly the same command (I copied and pasted it) it does not generate the Visio charts. Everything else runs fine and there is no stack trace outside of our own thrown error that goes off when the image is not where it is supposed to be. The exit code from the process is 0 as well and there is no output to either stdout or stderr (the windows equivalent) generated by the process and it has to complete or the exit code would be -1. Timeout isn't a problem as it has 50000 ms to run but always returns within a sec or less (you can see the error get thrown right after the call to the script).
I switched Jenkins to run under the admin account where everything is installed (moving it from SYSTEM) so it should have access to the PATH.
I have no idea what to do at this point.
This sounds like one of the Jenkins FAQs. Check https://wiki.jenkins-ci.org/display/JENKINS/My+software+builds+on+my+computer+but+not+on+Jenkins especially under the section "Desktop access (Windows)"
You're probably hitting http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6468220 and since it can't be fixed in the JDK, you need to finetune it in your code.
The problem is when Visio is started it is started as a child of the Jenkins service which is running without desktop interaction. Microsoft restricts its office product actions where a prompt might be generated which cannot be seen by a user. Even if you add allow interaction with desktop it will not work and in my case returned the following error value 2032466051. The solution was to only run it as a user and manually start the Jenkins instance every time we needed to restart the server.

It can't process the by clicking the spark-shell windows command script. What i do?

In the Process of installing spark 1.0.0 by double clicking the bin/spark-shell windows command script file. Then opened one command prompt file and then immediately closed it self only. Are there any commands required to run this. Could you please tell me step by step process.
First of all, you have to open a terminal. Theorically, you at least have the following on your machine :
cmd (for sure)
powershell (maybe not, if you're using Vista or less).
From there, you have two options :
if you added path_to_spark_folder\bin to your PATH variable (see there for more informations), you can run spark-shell as soon as the console is opened
if you didn't, you'll have to go to path_to_spark_folder\bin yourself, using the cd command.
You now can run spark-shell.

Categories

Resources