running a windows service from jmeter - windows-services

I am writing a jmeter script to perform DB functional testing. I have a Windows Service that runs every on X interval and it updates certain DB records when its done. I need to be able to run the windows service remotely and verify the DB changes.
Is it possible to run a windows service remotely say using sc \\machine stop <service> from jmeter?
If yes, how can I do this?
Appreciate any suggestions!

Look into OS Process Sampler.
For command like sc SERVER_NAME stop SERVICE_NAME it will be configured like:

Related

How to restart Oracle WebLogic on Docker containers

I'm using official WebLogic images to run the domain in Docker containers. In the development environment I have to experiment with settings, which requires the WebLogic to be restarted. However, stopping the admin server will also stop the container and all the data will be lost. How to come around with this?
Seems like my only painful choice is to experiment with the settings is in the build phase WLST scripts.

Understanding which tasks are running in a Dask schedular in a local environment

Assume we are running on a Localhost environment and my script is running some sort of Dask tasks.
Is there a way to find out what scheduler/tasks are running? (since I don´t know what port the scheduler is running on)
You can find out the various ports active in the scheduler by calling client.scheduler_info()
I would then recommend using the diagnostic dashboard if possible. The port for the dashboard is listed under "bokeh" in the "services" key
>>> client.scheduler_info()['services']
{'bokeh': 43917}
Alternatively you can always use the client.run_on_scheduler function to inspect scheduling state directly.

Docker run cron jobs in parallel

Using simple server
I was using a simple node (centos or ubuntu) to run my web application and also configured some cron jobs there to run schedule tasks. In that moment everything worked.
Using Docker Swarm Cluster
I migrated my application to Docker Swarm cluster. Now the crons are running in multiple containers at same time and that is critical for me. I know Docker is working on new feature called jobs but I need a solution for now. I will like to know if there is any way to just run one kind of cron job process.
Blocker
The crons are running tasks like:
create report about process.
send notification to another services.
updating data in the application.
The crons need to be run on the server because were configured to use interfaces and endpoint using php command.
My Problem
I created multiple instance of the same docker service to provide availability. All the instances are running in a cluster of 3 nodes and each of them are running its cron jobs at same time in parallel and I will like to run just one job per docker service.
Maybe it would be a solution to create periodically a docker service with restart condition none and replicas 1 or create a cron container with replicas 1 and restart condition any, it would be the scheduler and attach a volume with the required cron scripts.
There are multiple options.
Use a locking mechanism locking over NFS, or a database (MySQL, Redis, etc). You execute each job like this: /usr/local/bin/locker /path/to/script args. It may good to provide the locker options to wait for the lock or fail immediately if the lock is not available (blocking, non-blocking). Therefore, if the job is long-running, only the first one will acquire the lock, and others will fail. You may want to reuse some existing software simplifying the hard job of creating reliable locks.
Use a leader selection. When running in a swarm, there must be a mechanism to query the list of containers. List only cron containers, and sort them alphabetically. If the current container's id is the first one, then allow executing. first=$(get-containers cron | sort | head -n 1); if [[ "$current-id" == "$first" ]]; then ... fi
Run the cron outside of the cluster but use it to trigger jobs within the cluster over the load balancer. The load balancer would pick exactly one container to execute the job. For example curl -H 'security-key: xxx' HTTP://the.cluster/my-job.
I'm sure there are swarm-specific tools/methods available. A link.

Problems admin'ing my cluster on windows

I’m having problems admin’ing my cluster. I can run ‘standalone -c clustered.xml’ on Windows and everything looks ok. However, if I run ‘domain.bat’ I can’t see how to configure the domain.xml file so that it can see anything else on my local server. Is this somehow related to the host.xml file?
The domain mode is for administration, you can configure servers in cluster mode.
If you start with domain.[bat||sh] there are at least two java processes running.
A HostController, for administration/configuration and a ProcessController to start/stop or restart configured processes.
The domain.xml contains the configuration and here the profile is stored, i.e. caches, endpoints, ports, security etc.
The host.xml contains the server for this host-machine and the link to the domain-master.
Configuration is possible via console GUI or CLI commandline.

Easier way to start and stop windows services in Windows XP

I occasionally find myself starting and stopping multiple windows services. The only tool I'm aware of for stopping and starting windows services is the "Services" program under "Administrative Tools" (%SystemRoot%\system32\services.msc /s). This program seems to only allow you to manipulate one service at a time, often pausing while it waits for the service to stop. There is a "Close" button available, but I'd prefer to just select all the services I want to stop or start, and perform a single command on all of them at one time.
Is there an easier way to start and stop multiple windows services for Windows XP?
Use the "net start" and "net stop" commands in your cmd.exe to start and stop a service:
net start "Service name with space"
net stop SerivceNameWithoutSpace
Be aware that you will need quotes if the service name has spaces.
It possible to start/stop Windows services by using command-line tools such as net start and net stop and sc.exe, but as far as I known none of them allows to operate on more than one service at once.
The easiest solution is to invoke the command-line tool multiple times by specifying different service names in a batch file.
Also, note that the reason why there is a delay between issuing a stop command to a Windows Service and the time when the process actually exits, is due to the fact that the Windows Service Controller waits up to 30 seconds to allow services to shutdown properly.If a service doesn't exit by that time, a message will inform you that "the service didn't respond in a timely fashion". More details can be found here.
You could use powershell.
Something like :
get-service -displayname SQL | stop-service
This stops all services with SQL in their display name.
http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/stop-service.mspx
What about the command line?
The net start and net stop commands are where you're going...
Try msconfig (go to the "Run" dialog, type "msconfig"). Choose the "services" tab.
You could write a command/batch script that uses the command-line service controller, sc.exe.
Alternatively, you could check out the SysInternals psservice.exe command-line tool.

Resources