Why is SBT throwing error when running external process - sbt

I'm creating a task in SBT that will upload some scripts to S3. I'm uploading to S3 using SBT external process with aws cli s"aws s3 cp ./someDir $uploadPath --recursive" ! log.
It throws error
java.io.IOException: Cannot run program "aws": CreateProcess error=2, The system cannot find the file specified
This happens only on Windows. It works fine when I run the same project/task in Ubuntu build system. AWS cli is installed on Windows machine and PATH is set correctly.
Its not clear to me what is missing.

It seems that the sbt internal process library does not include the PATH variables in windows.
A suitable workaround would be to extract your aws command in a separate file and trigger the execution of this file:
your doSomeStuff.bat would be:
aws s3 cp ./someDir $uploadPath --recursive
and in the build.sbt add
lazy val someStuff = taksKey[Unit]("Execute a aws command")
yarnBuild := {
"./doSomeStuff.bat" !
}

Another possible workaround is to run the command inside a shell (and you must know your shells for all "problematic" environments)
val shell: Seq[String] = if (sys.props("os.name").contains("Windows")) Seq("cmd", "/c") else Seq("bash", "-c")
val command: Seq[String] = shell :+ "<your command here>"
command .!

Related

How to install and use mirthSync on MacOS?

Setup
I'm following the installation directions in the mirthSync readme, which is to clone the repo. The next indication of usage that I can see is in the Examples section, which via CLI is to "pull Mirth Connect code from a Mirth Connect instance":
java -jar mirthsync.jar -s https://localhost:8443/api -u admin -p admin pull -t /home/user/
I'm assuming that after cloning the repo, one should cd into that directory and then run the java -jar... command with all the appropriate flag values (server, username, password, etc).
Error
After running the CLI command, I get this error:
Error: Unable to access jarfile mirthsync.jar
Question
Where is this mirthsync.jar file supposed to come from? Is there something I need to do in order to generate the mirthsync.jar file?
Generate it via lein uberjar (which creates target/uberjar/*-standalone.jar) or download it from a release.

Hadoop MapReduce example command not found

I've installed the Hadoop file and I'm trying to run the MapReduce example in the terminal, but am getting the command not found message, can someone help me with this issue, thanks.
Ismails-MacBook-Pro:mapreduce korir$ hadoop jar hadoop-mapreduce-examples-2.7.3.jar
-bash: hadoop: command not found
The Hadoop command is only recognized from within your hadoop-2.7.3/bin folder. Unless you set the PATH environment variable to include that path.
Execute the command:
export PATH=$PATH:/Users/korir/hadoop-install-hadoop-2.7.3/bin
Consider adding this to a bashrc file to make it permanent.

QtCreator: use scp within Custom Process Step

I want to setup Qt in such a way that the sources or rather the whole project directory will be copied using scp as Custom Process Step within the Deployment. The sources will be translated later by the target machine itself. At the terminal this works well:
setsid scp -r . <user>#<host>:<path>
setsid asks for the password needed by ssh with a graphical prompt.
What is the correct parameter to get the project path as working directory?
How to avoid the following error?
Could not start process "setsid scp -r . <user>#<host>:<path>"
Error while building/deploying project MyProject (kit: Desktop Qt 5.10.0 GCC 64bit2)
When executing step "Custom Process Step"
The current settings of Custom Process Step:
Command: setsid scp -r . <user>#<host>:<path>
Arguments: left empty
Working directory: %{buildDir} I know - this is wrong
This is my working setting:
Deployment
Command:
setsid
Arguments:
scp -r . user#<host>:<path>
Working directory:
%{CurrentProject:Path}
When hit the Build button (Ctrl+B), a prompt asks for the password needed by scp, then the files will copied as specified in Arguments and in Working directory. In this case, the whole project folder will be copied.
Run
Command:
setsid
Arguments:
ssh -t user#<host> <command>
Working directory:
.
When hit the Run button (Ctrl+R), a prompt asks for the password needed by ssh, then the command will executed as specified in Arguments.
The point is, that Qt-Creator expects a return value from the command. In this case the command is setsid.

Jar file run on a server background with close putty session

I have tried the run spring boot jar file using putty. but the problem is after closed the putty session service was stopped.
then i tried up the jar file with following command. its working fine .
**nohup java -jar /web/server.jar **
You should avoid using nohup as it will just disassociate your terminal and the process. Instead, use the following command to run your process as a service.
sudo ln -s /path/to/your-spring-boot-app.jar /etc/init.d/your-spring-boot-app
This command creates a symbolic link to your JAR file. Which then, you can run as a service using the command sudo service your-spring-boot-app start. This will write console log to /var/log/your-spring-boot-app.log
Moreover, you can configure spring-boot/application.properties to write console logs at your specified location using logging.path=path-to-your-log-directoryor logging.file=path-to-your-log-file.txt. Also, it may be worth noting that logging.file takes priority over logging.path

Unable to run sqlplus commands from jenkins

I have a shell script at Unix Server which contain sqlplus commands to do some validation.and I can run script using putty and see required result.In Unix server I have set up Oracle path and Library path in .bash_profile file. So when I start putty , it get loaded and can understand sqlplus command.
Now Challenge is
when I call that shell script from Jenkins(Windows node) then I get error "sqlplus command not found". Here I call .bash_profile file first then my shell script which have sqlplus commands.
Please help.
Set up the PATH as an environment variable in your Jenkins job definition. More details here:
How to set up environment variables in Jenkins

Resources