I have Jenkins master on Ubuntu host in docker containers, connected to it is a windows slave that i run Jenkins on it using a PowerShell script that launch the agent:
java -jar agent.jar -jnlpUrl http://XX.XX.XX..../jenkins-agent.jnlp -secret XXX... -workDir "/jenkins"
we start the launch agent script using this script that creates the job:
$trigger = New-JobTrigger -AtStartup -RandomDelay 00:00:30
Register-ScheduledJob -Trigger $trigger -FilePath start_agent.ps1 -Name MyJob
my issues is:
when i go to the master UI and go to the slave node - i press on "logs" but it doesn't show anything, it just loads forever with 3 dots loading
I tried to redirect logs using *>&1 > output.txt at the end of the java -jar command but it doesn't work. and I haven't found any java jar argument that works in redirecting the output have tried -XX file path , couldn't find the Log4j file
i have a directory in the windows jenkins path named "remoting" and it has logs but it only have restart logs and not live logs\error logs and i need it.
Thanks.
Related
How to deploy the jar/war file in unix box and it should not stop after closing putty.
Steps tried:
Created jar/war file from Springboot project
Login to Unix box with root user
Created a Project folder in /opt path
Copied the jar/war file in Project folder
Executed below command to run the application in putty:
Command: java -jar myapplication.jar
Application is running fine but issue comes when i close my putty. Application shutdowns.
Any suggestions...
you need to create your custom service in your machine
EX: In Linux we use sudo systemctl start MySQL like that you have to create,
Please refer to this documentation which will help you to create your own.
EX: sudo systemctl start my_java_spring_service
I hope it helps!
I am trying to run one of my Jenkins agent which is based on windows 10 via running agent.jar using batch script.
What I did :
My batch file is in the same folder with agent.jar folder
I created the shortcut for the my batch file and placed it inside Microsoft/Windows/Startup folder so that every time computer reboots the agent.jar file execute via batch file
Upon running the file i am getting following warning from jenkins in my cmd and agent also not going online
WARNING: Are you running slave agent from an interactive console?
If so, you are probably using it incorrectly.
See http://wiki.jenkins-ci.org/display/JENKINS/Launching+slave.jar+from+from+console
<===[JENKINS REMOTING CAPACITY]===>rO0ABXNyABpodWRzb24ucmVtb3RpbmcuQ2FwYWJpbGl0eQAAAAAAAAABAgABSgAEbWFza3hwAAAAAAAAAB4=??
My batch file contains:
#ECHO ON
start java -jar C:\Jenkins\agent.jar
echo "The program has been completed"
Why I am getting this warning , because it is not working every time i have to run agent.jar file via cmd manually when i my agent machine restart , Is there trick the my agent runs automatically after restarts so I can get rid of this manual exercise
I'm struggling to start selenium grid on an azure VM via a powershell script in my build due to the following error....
System.Management.Automation.RuntimeException: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Error: Unable to access jarfile selenium-server-standalone-3.4.0.jar
The script simply contains java -jar selenium-server-standalone-3.4.0.jar -role hub and it runs fine locally. Java is installed on the VM.
Does anyone know what the issue is?
Thanks,
According to the script you provide, I suspect that you put the powershell script file in the same folder with "selenium-server-standalone-3.4.0.jar" so you didn't need to specify the path to jar file in the script. However, you need to use absolute path for "selenium-server-standalone-3.4.0.jar" file when you run the script from remote since the working folder is changed. Add the absolute path to the file or add "Set-Location" command in the script file to set the folder to the path where the jar file placed and then try again.
By the way, if you just call the "java -jar selenium-server-standalone-3.4.0.jar -role hub" command from the powershell script, you will keep waiting on the Remote PowerShell script step since the powershell script cannot be finished as the selenium server keeps running. I'd recommend you to start another process to run the selenium server like following:
Set-Location JarFileFolderPath
Start-Job -ScriptBlock {cmd /c start java -jar selenium-server-standalone-3.4.0.jar -role hub}
And make sure that stop the job after all your test is finished.
I need to run a Java application at windows shutdown. I have Windows 7 and I have tried to do this in 2 ways:
I have created a .bat file containing the following:
javaw -Xmx200m -jar C:\path\to\jar\dl.jar
dl.jar is the application I need to run at shutdown and I added in Local Group Policies->Windows Settings->Scripts(Stratup/Shutdown)->Shutdown->Script Name my batch file, but it doesn't work.
Also I have added in Shutdown Scripts from Local Group Policies at Script Name: C:\Windows\System32\cmd.exe and at Script Parameters the path to my batch file, it doesn't work in this way either
If I run the .bat file from command promt it works. Does anyone have any idea how to make this work?
Per the installation directions I run:
./bin/sqoop.sh client
and it returns error:
could not find or load main class org.apache.sqoop.shell.SqoopShell
I'm setting up Sqoop for the first time. I have the server up and running on Redhat Linux. Now I am stuck running the client on Windows Server 2012. I am running hadoop v2 and sqoop-1.99.3-bin-hadoop200. At the command line I verified java is installed by running "java -version" at the command line and seeing "1.8.0". Scoop is written in Java 1.6. Does that matter? I'm having difficulty locating an active download link to 1.6 for windows for troubleshooting.
I tried installing Cygwin and running the command. Same error.
Locate the directory traversal for the case of client in sqoop.sh
# Build class path with full path to each library
for f in $SQOOP_CLIENT_LIB/*.jar; do
CLASSPATH="${CLASSPATH}:$f"
done
Just add the following search and replace params (note changes of colon to semicolon in classpath)
# Build class path with full path to each library
PARAMSEARCH="/c/"
PARAMREPLACE="C:\\"
for f in $SQOOP_CLIENT_LIB/*.jar; do
f=${f/$PARAMSEARCH/$PARAMREPLACE}
CLASSPATH="${CLASSPATH};$f"
done
I had the same issue running on Windows 8.1. Turns out it's caused because sqoop.sh uses POSIX style directory paths. So / instead of . This results in the script being unable to set the correct CLASSPATH. This could have been remedied by using a cmd file for Windows. I don't know why they didn't do it. There are cmd files for catalina and such but not for launching sqoop!
Anyway I got around this issue by adding all the jar files in the shell\lib folder to CLASSPATH. You do have to add each & every jar file there and not just the folder path. A restart was required after this which was annoying. However the shell script will still not launch the client even after this change. The little trick I used is to just launch the client at the command prompt from the shell\lib folder with the following command
***java org.apache.sqoop.shell.SqoopShell***
Now I get the groovy prompt from where I can run all the commands provided here
I used the following steps to configure sqoop in a windows machine and now able to work with sqoop 1.99.3 successfully.
*Cygwin must be installed before continuing further steps. Also its just for using the native libraries, we can interact with sqoop directly from windows command prompt.
Save the sqoop package folder in “C:” drive name as sqoop
Copy the hadoop lib folder “hadoop” from C:\hadoop\share into C:\usr\lib\hadoop [If this directory doesn't exists, then create one]
Change the hadoop configuration properties in the file “sqoop.properties” from the location “C:\sqoop\server\conf” as below
at line:132
org.apache.sqoop.submission.engine.mapreduce.configuration.directory=C:\hadoop\etc\hadoop
Copy the sqoop.properties and sqoop_bootstrap.properties from “C:\sqoop\server\conf” into “C:\sqoop\server\bin”.
Set the environment variables for sqoop home as well as path:
SQOOP_HOME = C:\sqoop
Starting the server:
Open Command prompt (run as Administrator) and enter into the $SQOOP_HOME location and type command as follows
C:\sqoop> cd server\bin
C:\sqoop\server\bin> catalina start
The catalina server will be start and check it in the below location
http://localhost:12000/sqoop
Client Shell Command
Open the command prompt and enter the following command
java -classpath C:\sqoop\shell\lib\sqoop-shell-2.0.0-SNAPSHOT.jar;C:\sqoop\shell\lib\sqoop-common-2.0.0-SNAPSHOT.jar;C:\sqoop\shell\lib\sqoop-client-2.0.0-SNAPSHOT.jar;C:\sqoop\shell\lib\log4j-1.2.16.jar;C:\sqoop\shell\lib\json-simple-1.1.jar;C:\sqoop\shell\lib\jline-0.9.94.jar;C:\sqoop\shell\lib\jersey-core-1.11.jar;C:\sqoop\shell\lib\jersey-client-1.11.jar;C:\sqoop\shell\lib\jansi-1.7.jar;C:\sqoop\shell\lib\hamcrest-core-1.3.jar;C:\sqoop\shell\lib\groovy-all-1.8.5.jar;C:\sqoop\shell\lib\commons-lang-2.6.jar;C:\sqoop\shell\lib\commons-cli-1.2.jar org.apache.sqoop.shell.SqoopShell
The client shell command will be displayed as :
Sqoop Shell: Type 'help' or '\h' for help.
sqoop:000>
Hope this helps
Thanks