I am able to run my script successfully from jenkins when jenking is opened using war file.
If set the jenkinks as winservice my script is failing in middle.
I am trying to run a start.bat file from jenkinks, this bat file calls a java class. again this java class uses bat file to run a plink command.
Execution stops at this stepsif jenkinks is running as winservice and also I can't view the output as it is running in background.
Is there any way to make jenkinks behave normal while running as winservice
Thanks
Try this:
1. Go to services (hit windows key, type "services", select "Services" from the list of matches).
2. Find the Jenkins service and open it's properties
3. Switch to Log On tab
4. Change the service to run as you, instead of local system user.
5. Restart service.
Alternative is to fix local system user account (probably environment variables) so it works as local system user.
Related
Under the link http://docs.buildbot.net/latest/manual/cfg-buildsteps.html#shellcommand,
in the shell command it states that
On Windows, commands are run via cmd.exe /c which works well. However, if you're running a batch file, the error level does not get propagated correctly unless you add 'call' before your batch file's name: cmd=['call', 'myfile.bat', ...].
It says that the commands are executed cmd.exe.
I assume the cmd.exe is located in the c:\windows\system32\cmd.exe, am i right or it calls from some other location like in the windows startup .
The cmd.exe is the one found in the system path variable PATH for the Jenkins process. On my machine it is in C:\windows\system32\cmd.exe.
When running the neo4j server in Linux, we have several commands - start, stop, restart, etc - to control it via the command line.
In windows, the manual simply says:
Usage - Windows
Neo4j.bat
Double-clicking on the Neo4j.bat script will start the server in a console. To quit, just press control-C in the console window.
But how do I stop it if I've started it by executing neo4j.bat from a .bat file of my own, and thus don't have a console window?
For context: I'm working on an unmanaged extension, so I need to rebuild my jar, move it into the plugins directory and restart the server each time I make a change. It'd be a pain in the ass to do this manually, so (when when I was working in Linux) I had Intellij rebuild the artifact and execute a .sh script that moved the resultant jar into /plugins and restarted neo4j.
'/path/to/neo4j/bin/neo4j' stop
rm /path/to/neo4j/plugins/api.jar
mv /project/path/artifacts/graphapi.jar /path/to/neo4j/plugins/api.jar
'/path/to/neo4j' start
How do I do the same in windows using a .bat file?
I've tried this:
del "C:/path/to/neo/plugins/api.jar
move "C:/project/path/artifacts/api.jar" "C:/path/to/neo/plugins/api.jar"
C:/neo/bin/Neo4j.bat
hoping that simply calling Neo4j.bat again would stop the current process and start another, but apparently that's not the case.
If you're on Windows you can stop Neo4j server by executing: neo4j.bat stop
Let me show it in details for those who might be new to the command line:
We need to know where Neo4j is located. If you remember where did you extract it - good, you can skip this step. For others: open Task Manager and look for Commons Daemon Service Runner here how it looks like right mouse click, open Properties and look for its Location path. Find this path in your file manager. We are looking for bin folder with neo4j.bat file.
Open command line and write cd and then paste your path, hit enter. You should jump to that folder with neo4j.bat file.
Stop the server: Type neo4j.bat stop and execute. It will ask for your permission .
after that, you can double check and type 'neo4j.bat status` t be sure it's stopped.
P.S. After Windows reboot neo4j server will be automatically restarted. If you don't want this (it consumes up to 500Mb of memory, at least in my DB ~64k records) you should uninstall the service.
Execute neo4j.bat uninstall-service in that directory.
Cheers!
Hi i am trying to automate the process of sync and build chromium builds on a Jenkins server
http://www.chromium.org/chromium-os/quick-start-guide
./chromite/bin/cros_sdk --enter
i am trying to run something like this ,the desired output is expected to be a chroot prompt with a changed home directory, I have a Jenkins slave and when i do these steps manually, i am able to enter chroot without any issues and it provides me with the changed home directory and the path shows up where i need it to be for the next step ,
But when i roll this into a Jenkins Execute Shell on the same machine and same credentials, it is not able enter chroot,
./chromite/bin/cros_sdk --enter --log-level=debug
15:59:05: DEBUG: Cache dir lookup.
15:59:05: DEBUG: Configured cache_dir to '/media/1TB/home/qcaswnbu/jenkins1/workspace/Brillo_trial/.cache'
This is what i get in Jenkins
Manually though
./chromite/bin/cros_sdk --enter --log-level=debug
17:27:05: DEBUG: Cache dir lookup.
17:27:05: DEBUG: Configured cache_dir to '/media/1TB/home/qcaswnbu/jenkins1/workspace/Brillo_trial/.cache'
17:27:05: DEBUG: Configured cache_dir to '/media/1TB/home/qcaswnbu/jenkins1/workspace/Brillo_trial/.cache'
i get an extra line with the same message , could there be a chance its quitting half way through when it is initiated from Jenkins job ?
any input is greatly appreciated.
Thanks
Prem
when you run cros_sdk by itself, it expects an interactive prompt. i imagine Jenkins has no terminal attached (by design) which means trying to use it that way doesn't make much sense.
we've designed the tool so it can easily be scripted. if you have some command you want to run inside of the chroot, simply pass it as an argument:
$ cros_sdk -- ls /
bin build dev etc home lib lib32 lib64 ....
i think that should get you everything you need.
i configured out jenkins in way that it was launched under my account but when i build a project for my unit tests with KIF framework, Jenkins launches iPad simulator with black screen and nothing happens (jenkins also doesn't provide any useful information).
Can anyone advice to solution of this issue?
Please note that everything works just fine from command line.
Finally, i've found the solution need to use iPad Retina or iPad Retina (64-bit):
-destination OS=7.0,name=iPad Retina
So, the last supposed suggestion doesn't work either - need another solution.
Just ran into this myself. Following up on user2738882's self-answer, I have a fix for the pitfalls his solution has:
He's correct that it was occurring due to Jenkins being run as a launch daemon process. Daemon's are launched at start without login, but they aren't intended to have access to the UI. This is what causes the issue.
Unfortunately Jenkins defaults to installing as a launch daemon if you install via the Archive (.war).
The solution I went with is to move it over to a launch agent. To do so follow these steps:
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
sudo cp /Library/LaunchDaemons/org.jenkins-ci.plist /Users/<Path to Jenkins User>/Library/LaunchAgents/org.jenkins-ci.plist
Right click - > Get Info on the org.jenkins-ci.plist file
Change the read write permissions to all users (bottom)
Modify the plist file to change GroupName key value from "daemon" to "agent"
Right click -> Get Info again
Reset the file access to as it was before
sudo launchctl load /Users/<Path to Jenkins User>/Library/LaunchAgents/org.jenkins-ci.plist
The drawback of this approach is launch agents don't start until the user they're associated with logs in. In order to accommodate this I've configured my Jenkins user to login when the server starts up. To do this:
Open System Preferences
Open Groups & Users
Login Options
Set your Jenkins user as the Automatic Login:
This is obviously a security concern, but these machines should only ever be accessible on your local network and in a secure location anyway. Regardless I set the machine to show a screensaver as quickly as possible with a login.
The work-around that I see is that you can create AppleScript, which will run a simulator using terminal. Example:
do shell script "script"
where, script is your terminal command.
After script is created, add build step 'Execute shell script' to jenkins and write script which will run your AppleScript.
Example:
open /Applications/MyScript.app
The issue was in Jenkins and it was solved in the following way:
Stop the jenkins daemon via command:
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
Start Jenkins as process via command:
sudo nohup java -jar /Applications/Jenkins/jenkins.war --httpPort=8080 --ajp13Port=8010
And it works perfectly!
But there is a pitfall, after launching Jenkins under your user, all jobs disappear and you need to create it once again.
I have the following problem: I have an ANT-task in Jenkins-CI that (apparently) needs access to OSX' window server (it needs to show a window). After doing some research, it appears that only the currently logged in user and the 'root' user (or SUDO) can access OSX' window server.
The ANT task (Adobe ADL) is one that actually 'runs' a build, so it has to popup a screen.
I'm on a macBook running OSX 10.7.something (Lion), Jenkins 1.487, Ant 1.8.4.
What i have tried so far:
to start with, tried the 'barebone' < exec > task to invoke ADL. Works, but getting error that means that Jenkins running as daemon (with homedir /Users/shared/Jenkins/Home) cannot access OSX' Window Server.
Run Jenkins as myself, by changing USER_NAME, GROUP_NAME, JENKINS_HOME in the jenkins launchd.conf file: https://wiki.jenkins-ci.org/display/JENKINS/Thanks+for+using+OSX+Installer
this gives a lot of errors/trouble, which i tried to solve in communication with the creator of the Jenkins CI but, unfortunately to no avail.
Try to have Ant run an < exec > task (running a shell script) in which i try to sudo with a password using this sneaky way of passing a password to the stdinput: echo < password > | sudo -S < command > which is really bad, but as i'm running Jenkins locally (not reachable from the outside of my LAN) it's np.
Tried to have Ant run an < exec > task, using a 'redirector' with as inputstring my password. also superbad, but yea, i just want it to work. which it did not.
Tried a Jenkins SSH plugin: didn't work. I could, however, SSH to my own localhost using terminal, thing is, i don't know what the Jenkins SSH was trying to do (how can i figure that out anyway?) so i don't know why it wouldn't work.
Tried to have Ant run an SSHEXEC task (which, after some hours, finally worked. Ant for mac is borked, something with optional .jar tasks not being re-named correctly or something) but i'm getting a "com.jcraft.jsch.JSchException: Auth fail" which i googled for, and can't seem to resolve. only applicable solution is to have sshd accept password auths, did that, still got the same error.
I think what i want to accomplish was NOT worth the 2 days that i spent so far on this problem, although i learned a lot. However, i just want this to work and will not accept defeat, yet :)
My question: have you had to solve a similar problem, how did you go about it? are there any other methods i can try to solve this problem? Is there a method mentioned that should JUST _WORK_ and i did something wrong?
[edit] I have decided to go with the Jenkins standalone app, as i think (for me) this is a nicer solution in total, as my laptop is not a build server. Also, the Jenkins app can start at startup so it actually acts as a local server.
Just a quick guess: if you don't want the interactivity of the script, and the script can do without it, you can try to set the headless mode on the java command-line:
-Djava.awt.headless=true
I have decided to go with the Jenkins standalone app, as i think (for me) this is a nicer solution anyway, as my laptop is not a (headless) build server. Also, the Jenkins app can start at startup so it acts as a server too.