How to freeze a service for sometime in nsis? - nsis

My requirement is to freeze a servise group for around a minute(60 secs). How can I do that in nsis?
I guess it would be something like this:
hagrp -value Service Frozen...

You can execute applications with Exec/ExecWait:
Exec '"$instdir\myapp.exe" /param1 "par am2" /param3'
If you want to execute a console application without showing the console window then you have to use one of he exec plugins: nsExec, ExecDos
or ExecCmd.
Edit:
There are several plugins and scripts to choose from if you want to manipulate a Windows service...

Related

creating a GNU screen during deployment by AWS codeDeploy

I am trying to create a Linux screen during the deployment using AWS codeDeploy.
The purpose is to run the application inside a screen. I want codeDeploy being able to create a screen in detached mode and start the application inside it.
I tried these commands in AfterInstall and BeforeInstall stages:
screen -RS
screen -dm
But, when the deployment finishes successfully, the screen has not been created.
Also, if I try to send a command to the screen that I have tried to create in the previous stage, I get this error:
[stdout]Must be connected to a terminal.
So, my questions are:
How to get codeDeploy running the application inside a screen
Is it even a decent way of deployment? Maybe I am not supposed to do that at all.
Well, I had made a couple of mistakes that caused the failure.
codeDeploy runs under root user by default. And any screen it creates is not visible to other users. You may want to run codeDeploy as another user (there is a tutorial in Amazon for this), or run your commands in the codeDeploy scripts with runuser (as a user other than root)
any try to attach to a screen (or create a screen in the attached mode) is doomed to fail, because codeDeploy is not connected to a terminal. You need to create the screen in the detached mode. For example, by: screen -dmS name

Running exe file in background in windows 10

How do I run an "exe" file on start up and in background?
I tried keeping the file in shell:startup folder but when it runs, the icon appears in taskbar which I don't want. How do I get rid of that icon in taskbar? Basically, I want to run the app in background.
You can make easily a service out of it using the Non-Sucking Service Manager
It can be used as commonad-line tool and it has a graphical user interface.
In the System services you can start/stop the service and make it run mode Automatic

Update-AzureRmVmss command hanging and does not work when try to install custom script extension

I'm trying about three days to run and get result from Update-AzureRmVmss command using powershell. However after lasting 20-30 minutes of waiting, it ends with offering reconnect or quit pop-up window. Is it related with azure infrastructure? Can not azure update vmScaleSet faster?
I need to from time to time update custom script extension and apply changes to virtual machines.
Any help would be appreciated.
Solved!
The problem was in my custom script extension. After downloading and running application there was -Wait command at the end of script. That was causing process to not finish

Powershell scripts going to sleep

I have a powershell script which loops over each file in a folder and does a lot of "high-computation" tasks on each of these files. I have multiple instances of this script running on my system.
I do use a write-host before starting each of these tasks to see when these tasks start and end.
I started these instances of the script last night and when I came today morning I noticed that some of my powershell terminal were stuck at a write-host command and when I pressed ENTER they wrote that content to terminal and continued the preocessing.
It looks like some of these terminals go to sleep. Why am i seeing this and how can i prevent this?
Disable the "QuickEdit" option in the "Windows PowerShell" Properties window.
Right click the PowerShell window to get the to the Properties window.

How to run something just before the files are installed?

I would like to know how to run something just before files are installed using NSIS.
I know about the .onInit function. That function runs when the installer is first starting. That is not what I want. I would like to run something after the user has clicked the install button but before the files actually get installed.
To be more specific. I have a windows service. When the installer is upgrading the windows service, I need it to stop the service - but only once the user is committed to the install - not when first starting the installer. Then it can upgrade the files and finally (re)start the service again. This seems like it should be a common requirement, but I haven't been able to find anything.
If it matters I'm using the MUI instead of classic.
All sections are executed on the instfiles page and they are executed in the same order as your source .nsi so you can just add another (hidden) section:
Section
# Do service stuff...
SectionEnd
Section "Required Files"
File xyz.abc
SectionEnd
Section
# Do service stuff...
SectionEnd
As Anders said - create invisible (hidden) section which is very first of all sections in your script and stop the service there.
When the other sections will be executed the service will be stopped.
Tip: maybe you should wait few seconds to let service manager time to stop the service.

Resources