Batch as a windows service - windows

I am running a Jenkins on windows machine with the process of Jenkins.war.
'java -jar jenkins.war'. If I close the command prompt of the service, Jenkins will go down. I want the Jenkins to be up even if the command prompt closed and even after machine reboot, this jenkins to be started. How can we do this on windows machine?

You can use create-windows-service-from-executable to make your jenkins.exe as a service. Or else while installing itself, install as a service rather than starting from command line

Related

How to kill server via terminal in VS Code?

Our local Macs are set up to run our local server via grep serve
When running from standard terminal, that command builds the project then spins up the local server. To kill it, I can use the break command (command-.).
We're doing a lot more in VS Code now which has the great feature of Terminal built in. However, it appears the command-. doesn't apply to that version of the terminal. So I'm at a bit of a loss...how does one stop the server via the terminal in VS Code?
Crtl+c should kill the currently running process in your terminal (VSCode or otherwise).

windows . how to automatic satrt apache2 in ubuntu windows

I want to automatic start apache2 in ubuntu windows. So when startUp my laptop no longer running comment
service apache2 start
My OS is windows but i run apache in ubuntu windows.
You can make any program run at startup (even bash on windows) by going to Run, entering shell:common startup and adding a shortcut of the program in that folder.
Or simply place a shortcut of bash in the following location C:\Users\<YOURUSERNAME>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
But you cannot startup apache2 as a service, only as daemons:
Background tasks, daemons are now supported starting Insider build 17046. See theĀ blogĀ for more details. But, auto start of services is still not available.
https://github.com/Microsoft/WSL/issues/511

Continuous integration with microcontrollers

Just learning about CI and jenkins and wanted to take this concept to the embedded (basically microcontroller) world. The first step is just making sure builds don't break, but then I realized, I don't have a way to execute a build from a shell script on a linux machine (ubuntu server) for a build that usually happens with an IDE on a windows 7 VM. How can I automate opening up a Windows 7 VM and then building an MPLABX project for example.
I'm doing the same thing; a Jenkins server running on Ubuntu, and builds need to happen on Windows with some toolchains that don't always work well for automated builds (IAR in my case).
You can set up a Windows machine/VM with the right tools (incl. Java and git or whatever SCM you use), and install a Jenkins slave agent on it (see https://wiki.jenkins-ci.org/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines).
Connect it to the Jenkins server as node/slave.
Now create a job that uses the "Windows batch command" build step. Your IDE probably has some way to build a project from command line.
Add a post-build step to archive artifacts, i.e. the built files you care about.
-> You can connect your Windows VM as jenkins node and activate Jenkins as service in it.
-> Try to build or run your project from command line. (windows cmd prompt)
-> If your tool has own prompt then invoke your prompt by using normal windows prompt and use.
-> After this you can run your commands in Jenkins using "Windows batch command"

How do you install dependent programs with a batch file?

I'd like to install two programs (program.exe, program_sp1.exe) via batch script.
The problem is that the first install adds environment variables that are needed by the 2nd.
Is there a good way to run the 2nd installer in a new command prompt so the values are picked up, but without user interaction to close it?
I've tried this in a Windows 7 Machine.
You should be able to run program.exe and the run cmd and then run your program_sp1.exe, and an exit as the cmd is running another version in itself with the updated environment variables.

How to install oracle jdk 7 silently in script with dependency?

I am trying script the install for Glassfish on a 64bit windows 2008 r2 server. But in order to install that, I need a JDK. Therefore, I am trying to silently install JDK 7 (u21) prior to glassfish. My problem I'm finding is that when I kick off the install using the following command, the command line immediately returns, so I have no way of knowing from the command line when the install is complete as it appears to run in the background.
REM Copy jdk installer and run silently
copy x:\java\glassfish\windows\jdk-7u21-windows-x64.exe jdk.exe
jdk.exe /s
My next step then immediately kicks off prior to my jdk being installed, which causes the glassfish installer to fail.
copy x:\java\glassfish\windows\glassfish-3.1.2.2-windows.exe glassfish.exe
REM command to silently install GF goes here
Is there a flag I can pass in to the jdk installer to force it to not run in the background, so that when my script is able to run the next command, I am certain that the JDK is installed?
Or does the very nature of running it silently mean that it will simply run in the background and there's no way around it? And if this is the case, any thoughts on how I could get my script to wait for the jdk to complete prior to continuing?
use START with the WAIT par, ie
START /WAIT jdk.exe /s
Start is an internal command to cmd.

Resources