Toggling a set of services in Windows from the command line
systemsToggling a set of services in Windows from the command line
I work on my business’ WordPress site on my home PC which emulates our server environment. The stack I’m currently running is Nginx, PHP and MySQL.
These pieces are all registered as services in Windows so that I can turn them off and save resources when I’m not developing. MySQL
registers itself as a service but nginx
and php
need to be registered manually, which I was able to do with the help of NSSM which is a nice command line interface for creating, starting and stopping services (no more running services.msc
!!!)
I’ve found that typing nssm start nginx
, nssm start php
, nssm start mysql
is wearing down my sensitive fingers so I added a function to my .bashrc
which looks like the following.
cbb() {
nssm $1 php
nssm $1 nginx
nssm $1 mysql
}
If I run this in an Admin bash
prompt then I can start or stop all my services related to my CBB work in one command. Nice!