The following bat file is working when running this directly on the machine.
#ECHO OFF
echo Starting the Application ...
START "app" java -jar app-0.0.1.jar
When calling this file via Jenkins it's not working.
Any idea why?
Thank you
Related
I created an instance in Google Cloud Compute Engine (Debian OS) to host a Spring Boot Maven Application. I installed maven.Now while configuring the instance I added below script in the automation startup box -
cd spring-boot-app/
mvn clean package
cd target/
nohup java -jar artifact-1.0.jar &
I used nohup and & to run the application in background.
Now when I stop then start/resume the instance and open terminal through SSH & run the following command -
ps ax | grep java
I don't see my app running. What I am doing wrong here ?
When monitoring the logs, I found this -
cd spring-boot-app/ directory does not exists
So I realized that the script is being executed in the root directory. And when I connected to the terminal using SSH in Google Cloud Compute Engine VM I was redirected to home directory of my username.
Thus by updating the script I was able to run the startup script.
cd home/{username}/
cd spring-boot-app/
mvn clean package
cd target/
nohup java -jar artifact-1.0.jar &
To Run a qlikview file I am using batch file it is working fine ,I am using below command in batch file "path\qv.exe" /r "path\myapplication.qvw"
When I am trying to run above batch command through jenkins job it is continuously running.
"path\qv.exe" /r "path\myapplication.qvw"
The related post is here
How to run .qvw (qlikview) file through Jenkins
THe sulution is just go to services.msc and log on as a administrator then in jenkins create a project and call a batch command having below command, "path\qv.exe" /r "path\myapplication.qvw".It will do the job.
Question: go to services.msc for what?
what is the detail steps to solution this issus:jenkins job it is continuously running.
Go to services.msc and select the Jenkins service and log on the Jenkins service as a administrator in the Jenkins service log on page.
In jenkins create a project and call a batch command having below command, "path\qv.exe" /r "path\myapplication.qvw".It will do the job
My jenkins is installed in C:\Program Files (x86)\Jenkins
bat file is located in C:\Users\Admin\workspace\demoWork\run.bat
When i run this bat file from cmd everything works fine. But when i try from jenkins executing batch command as mentioned in Image, Jenkins displays error as
Build step 'Execute Windows batch command' marked build as failure
Also inside jenkins folder automatically workspace folder gets created with Job title name. Can you guys please explain me in detail
Tatkal, you can't execute a command like in your image,
why don't you simply try
C:\users\admin\workspace\demowork\run.bat
or
call "C:\users\admin\workspace\demowork\run.bat"
"Also inside jenkins folder automatically workspace folder gets created with Job title name. Can you guys please explain me in detail" -
Jenkins creates folder with job title name automatically, saves jobs data and other build info... this is how it works. By default in jenkins job you can access your workspace using $WORKSPACE variable
You have put very little detail into this so I'm going by pure guess..
The Execute Windows batch command is to literally execute code, not execute a file.. to execute the file you could use this command :
start cmd.exe /c C:\myprj\mybat.bat
or you could take the contents of the .bat file and rewrite in in that command line..
The way Jenkins works is it creates its own workspace for each job, essentially to sandbox the environment, its a testing framework so it should be used to stage changes to code, which will then be pushed to your live(working) environment. People use it to automate some tasks, but this isnt the primary use of Jenkins.. if the above doesn't help you let me know more details of the error and I can try help you with it.
node {
bat 'D:\\gatling-charts-highcharts-bundle-3.0.2\\bin\\gatling.bat'
}
I have a jar called a.jar. When I execute it with java -jar a.jar everything works correctly. But when I create this .command file:
#!/bin/bash
java -jar a.jar
execute chmod u+x launch.command and run it by double clicking, the terminal window displays
Error: Unable to access jarfile a.jar
When you run a .command file, it executes in your ~ (user) directory, that is why it is not able to find your a.jar file. You need to give the path of your a.jar to execute it from your .command file.
#!/bin/bash
java -jar path-to-file/a.jar
If running this from Intelli J on a Mac, always add the path-to-file which in my case was the target directory. Navigating "into" the target directory and running java -jar test.jar was the problem for me. The correct way is;
java -jar target/test.jar
This can happen when your are connected via SSH and the machine user is not logged in or its locked. MAC OS does not allow to run java -jar commands and returns Error: Unable to access jarfile a.jar. In order to solve it, just do the user login first.
I thought I had set up a successful schedule in Windows to run a PHP script. But all I got was an error which slaps only when run through the task scheduler.
Here is how I run the task:
I created a batch file runCron.bat:
start php.exe reportGenerator.php
and placed reportGenerator.php in the same folder as of the batch file.
When I manually execute the batch file, all is well. But when the same batch file is called by the task scheduler, PHP CLI throws the following error:
Could not open input file:
reportGenerator.php
What would have been missed? I understand it's a path issue, but where exactly is the issue?
Thank you for any help.
try
start php.exe -f c:\full\path\to\reportGenerator.php
it probably looks for the script in the schedulers working directory, not in the bat file dir