I use Jenkins to run our builds. What I want to do is to wakeup the monitor before build starts. This is what I have done so far.
Use nircmdc.exe (http://www.nirsoft.net/utils/nircmd.html) and prepare a batch file to turn on monitor. I have tested the script through command prompt and it works fine.
Then I add a build step in Jenkins to execute windows batch file before running the ANT script. Then I remote start the build (via URL). Console shows that the batch file is being executed. But the monitors doesn't wake up.
Then I included a target in ANT to execute the same batch file and tested running the ANT via CMD. This wakes up the monitor and continue with the build steps.
But, if I run this ant script from Jenkins, everything works fine except waking up the monitor.
Is this something to do with privileges ?
Has someone done something similar?
Don't think I've ever heard of a requirement to wake up the monitor, so probably no one has done anything like this.
However, your problem is probably due to Jenkins process running in a separate session from your machine's console. Have a look at my answer here: Open Excel on Jenkins CI, it explains how to get around the session issue.
Related
I have wrote a script in playwright i made a .bat file to run it when i run it manually the script runs and works perfectly but i want to automate the entireprocess to run each day morning
I tried to use task scheduler but when i put the same bat file in task scheduler its not running. i tried giving it an action to start node and my script to be run as an argument but still it didnt work i looked online for ways to make this work but i couldnt find a way to make it work in windows task scheduler
I have a few files i want to make sure I keep up to date using Tortoise SVN. I've used commandline and also created a batch file and both run successfully when I user-execute them.
However, when I use Windows Task Scheduler to try and schedule an automation for the batch script, it doesn't run successfully; it just hangs and runs endlessly. The log file looks just the same whether using the automation or not. That said, I have to manually end the automation in task scheduler and then run an SVN cleanup command to remove the locks that remain on the file from the incomplete task.
What is causing this, and how do I make it so that the automation successfully runs and doesn't have the file-locking problem?
My back script's code is below:
svn update --accept theirs-conflict C:/MyFolder/myfile.R
For transparency, I've tried changing the option 'theirs-conflict' to other settings (and removing it completely). The symptoms are the same in every scenario.
I have some trouble keeping alive a background process when launched by TFS.
Usually I use a batch that launch a java server (new window), as long as I keep this window open it works properly.
C:\Users\TFSService\mbs-iot-sdk\osgi\bin\vms\jdk\server.bat
In order to make my process automatic, I include this in TFS. In the step I call a batch that contains the following:
cd C:\Users\TFSService\mbs-iot-sdk\osgi\bin\vms\jdk // necessary to find the batch
start C:\Users\TFSService\mbs-iot-sdk\osgi\bin\vms\jdk\server.bat
In my task manager, I can see in background tasks that java is launched (no new window is opened), exactly as it behaves when launching directly the batch. But after a few seconds, when TFS switches to the next step, it stops.
Then the next step carries on but fails as it requires the server to be launched.
Is there a particular way of doing it in TFS ?
thank you
Alexandre
It's suggest to launch the .bat file from a relative path not directly use cd to hard code the path.
Also recommend you to use Run Batch File task not Run Command Line task to launch the .bat file.
According to your description, seems you are using a run command line task in your build pipeline. Then run the command under the working directory c:\Build_work\5\s, the command cd to C:\Users\TFSService\mbs-iot-sdk\osgi\bin\vms\jdk\ on the build agent, find the server.bat, run the server.bat.
First check if the .bat file is located at the path you are specifying on the build agent. Not sure if the bat file have to run under C:\Users\TFSService\mbs-iot-sdk\osgi\bin\vms\jdk\, guess you are also hard code the path in your server.bat file. Suggest you change all the path to relative path, you could use some built-in variable in TFS.
As for your workaround in comment, seems you want to chain builds in TFS. The official docs literally say "not yet" and have a uservoice in planed. However you could use some workaround, such as create or use other's customize extension (use rest api) to call another build. Detail ways please refer huserben's answer in this question: How to chain builds in TFS 2015?
Note sure you have to go deep into this area for your original issue. Just add some related info in case you are interested or need.
Well,
Just in case someone else goes through the same kind of issue, I found a workaround:
I wish to mix different command line steps, some of them launching Python scripts:
I have one step for launching the server that is required for my testing tool, one step for my testing tool and one Python step for differential testing
I realized that I could embed everything in a Python script.
It can handle server launching process in a separate window (with subprocess), launch my Python part and launch another process for my validation tool.
I have to test the whole chain but, at least, I solved my problem of launching a background process and detach it from TFS
I have a ClickOnce application that we start on Log on and recurring. After I install the application the tasks work fine, but if I reboot the machine the scripts run but they fail to start my application. I added logging to the BAT file and I know it is executed, but calling the rundll32 line produces no result and generates no errors.
If I manually run the script, from explorer, it works and task scheduler executions start working as well. Also, if I manually run the clickonce shortcut the scripts start executing from the Task Scheduler. Is there someway to verify that dfshim is loaded, or load it before executing it? What am I missing? I tried clearing the cache and that seemed to fix it on one machine, but it seems like a coincidence because it did not fix it on another machine.
VBS Script Called first(Called By Task Scheduler):
Set WshShell = WScript.CreateObject("WScript.Shell")
obj = WshShell.Run("C:\Users\brnapolitano\AppData\Roaming\FirstAmerican\TaskScheduler\AppReferenceInvoke.bat", 0)
set WshShell = Nothing
BAT Script Called Second(Called by VBS above):
rundll32.exe dfshim.dll,ShOpenVerbShortcut
C:\Users\brnapolitano\AppData\Roaming\Microsoft\Windows\Start
Menu\Programs\FastLocalService\FastLocalService.appref-ms
I would like to make this a script fix, but if that's not possible, I will try adding it to the startup and see if that resolves my issue.
I found the answer(linked below). I am still in the process of testing, but it seems to work. dfsvc needs to be run, if not active, before running the command to start the shortcut.
ClickOnce app not starting from the scheduler
It's not clear from your post what is happening after reboot. After the reboot are you trying to run the scheduled task after logon or before logon? If the latter, your vbs and bat files are most likely running under a different security context than what you think it is. That could also be the case after logon depending on the settings in your scheduled task.
See Task Scheduler is not supporting option "Run with highest Privilege" and "Run weather user is logged on or not"
I am struggling to make a Task Scheduler task successfully runs a batch file which contains a vmrun command to start a VM. I am using VMware Workstation 12.5 in a Win 7 x64 (unfortunaltely I cannot test in others). I already had searched on other websites (including stackoverflow) and tried different approaches but I really do not understand what is going on with this simple command.
The command I am using to start the VM is this:
vmrun start "C:\Virtual Machines\Windows7x64\Windows7x64.vmx"
What I did so far:
run it in the command line to make sure it is working
created a batch file with the command above and run (through command line and double-clicking on it) to make sure it is working
created a task in Task Scheduler pointing to the bat file, configured with high privileges, run whether user is logged on or not
when I run the task (manually or waiting for the schedule time) I can see that the task starts running, although the VM is not started ever, and after just more than 1 minute, the task is finished with Last Run Result 0x0 (which means it succeeded through this link: https://msdn.microsoft.com/en-us/library/windows/desktop/aa383604(v=vs.85).aspx)
I tried the same approach using the command to stop the VM and it works!
vmrun stop "C:\Virtual Machines\Windows7x64\Windows7x64.vmx" soft
Anything I am missing here? Same command runs through command line and running the batch file, although not from Task Scheduler. Any hints, please? Any details I am loosing to look at?