How to safe restart jenkins? - jenkins

I tried few ways to safe restart either in CLI using the command "java -jar jenkins-cli.jar -s http://localhost:8080/ -webSocket safe-restart" which says - "ERROR: Unexpected exception occurred while performing safe-restart command.
hudson.lifecycle.RestartNotSupportedException: Default Windows lifecycle does not support restart."
Tried http://localhost:8080/safeRestart - Jenkins cannot restart itself as currently configured.
Can anyone solve this issue of mine. I'm using generic jenkins via jenkins.war file

Related

Installing local plugin via jenkins-cli

I've enabled 'Enable CLI over remoting'.
I've set TCP port for JNLP either fixed or random.
I've downloaded the jenkins-cli.jar successfully.
when preforming plugin-install command i receive:
When executing: java -jar jenkins-cli.jar -auth user:pass -s http://localhost:8080 install-plugin file:///folder/plugin.hpi
ERROR: Unexpected exception occurred while performing install-plugin command.
java.io.FileNotFoundException: /folder/plugin.hpi (No such file or directory)
Without the file://
/folder/plugin.hpi is neither a valid file, URL, nor a plugin artifact name in the update center
I've tried every possible combination, the file does exist.
Edit: from the exception it keeps thinking that it's url instead of file:
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
at java.net.URL.openStream(URL.java:1045)
at hudson.FilePath.copyFrom(FilePath.java:890)
"
Edit 2: It does work when given HTTP URL, but it will require me to upload it to a server which I don't have every time.
Edit 3: I tried moving the file to the same folder of Jenkins /var/lib/jenkins and give it permissions of 777.
It was a combination of #Alex O solution, and that I used -auth myuser:mypass instead of --username admin --password password and toggled --remoting.
It looks like this:
java -jar jenkins-cli.jar -s http://host-ip:8080/ -remoting install-plugin ./plugin.hpi --username my-user --password my-pass -restart
The URL that you provide as argument to install-plugin must be accessible by the Jenkins master process. If you get the error message
/folder/plugin.hpi (No such file or directory)
then there's most likely a problem with access rights, or /folder is not mounted on the master's host (or in the master's container, if you use docker).
This is why a HTTP URL does work.
So, for file:// URLs, you need to align filesystem mounts and permissions between CLI user/machine and Jenkins master user/machine.

Cannot start Jenkins server

Cannot start jenkins. giving below logs when try to restart but doesnt work -
-bash-3.2$ ./jenkins.sh start
Jenkins is currently stopped...
Starting Jenkins with command cd /eas/jenkins;/eas/jenkins/jenkins_jre/jre1.7.0_51/bin/java -Xms1024m -Xmx2048m - XX:MaxPermSize=512m -DJENKINS_HOME=/eas/jenkins/home -jar jenkins.war
-bash-3.2$ standard in must be a tty
Please help!
No, adding to sudoers file didnt solve it. there was issue with JVM where JDK was not able to initialize because of size I gave as arguments were not available, reduced and it worked.

Using the jenkins CLI (on fedora 23)

I have a jenkins instance running. To create this instance on a Fedora 23 machine, I installed jenkins (via dnf) and started it (via systemd). It is running and I can see it in my browser at http://localhost:8080.
I have been trying to follow the directions in https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI.
I download http://localhost:8080/jnlpJars/jenkins-cli.jar to my computer.
Then I try to run the program java -jar jenkins-cli.jar http://127.0.0.1 -s help and I get no main manifest attribute, in jenkins-cli.jar
When I check jenkins-cli.jar, sure enough there is no Main-Class entry in the manifest file.
What is the proper way to invoke the jenkins cli?
Addendum
https://wiki.jenkins-ci.org/display/JENKINS/Starting+and+Accessing+Jenkins has a separate procedure for using the jenkins cli, but it does not explain where to obtain jenkins.jar.
I have worked out a kludgy solution. I hope someone has a better idea.
On my instance I run
curl http://www.java2s.com/Code/JarDownload/localizer/localizer-1.9.jar.zip > localizaer-1.9.jar.zip
unzip localizaer-1.9.jar.zip
curl http://central.maven.org/maven2/commons-codec/commons-codec/1.9/commons-codec-1.9.jar > commons-code-1.9.jar
java -classpath /usr/share/jenkins/webroot/WEB-INF/jenkins-cli.jar:/usr/share/jenkins/webroot/WEB-INF/remoting.jar:/usr/share/jenkins/webroot/WEB-INF/slave.jar:/usr/share/jenkins/webroot/WEB-INF/classes:localizer-1.9.jar:commons-code-1.9.jar:localizer-1.9.jar hudson.cli.CLI -s http://localhost:8080 help
I don't like it because it is super-kludgy, but it seems to work.

parallelshell command not found

When I run parallelshell command (I installed parallelshell using npm install -g parallelshell), on the server, it works. But when Jenkins runs the command, I get the error, parallelshell command not found.
Why is Jenkins not recognizing the command? the command works for me when I log into the server.
Jenkins may be running under different user(That is default in Windows service, or linux installations). This will have different path variable and other user-specific settings.
You must give absolute path to command.

How to start Gerrit in Windows 7 after Initialization

I did the procedures as recommended by vogella to install gerrit on windows.
I downloaded gerrit2.10.war from the releaase site
Then I created a gerrit folder in C drive
I ran the commands
cd C:/gerrit
java -jar gerrit.war init -d C:/gerrit
Then on pressing enter (i.e using default) for every questions I got the message:
Initialized C:\gerrit
Then to start I tried the command
java -jar gerrit.war daemon -d C:\gerrit
but it didnt show any message or performed any action.
On checking the error_log in logs in C:\gerrit it was shown like
ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon
If someone knows to resolve this issue please help.
Thanks

Resources