-
-
Notifications
You must be signed in to change notification settings - Fork 18
Servy CLI
Servy includes a command-line interface (CLI) designed for full scripting, automated deployments, and seamless integration into CI/CD pipelines.
The CLI offers a lightweight, script-friendly alternative to the GUI, focusing on automation and headless use cases while leveraging the same core service management logic as the desktop application.
Once you install Servy, the CLI executable will be available at:
C:\Program Files\Servy\servy-cli.exe
To get started, open a command prompt or PowerShell window, navigate to the CLI folder, and run:
PS C:\Program Files\Servy> .\servy-cli.exe help
Servy.CLI 1.0.0+8991a88b22fbe4e6ab547a6583da826efdfe2932
Copyright © 2025 Akram El Assas. All rights reserved.
install Install a new service.
uninstall Uninstall a service.
start Start a Windows service.
stop Stop a Windows service.
status Get the current status of a Windows service. Possible results: Stopped,
StartPending, StopPending, Running, ContinuePending, PausePending, Paused.
restart Restart a Windows service.
export Export a Servy Windows service configuration to a configuration file.
import Import a Windows service configuration into Servy's database.
help Display more information on a specific command.
version Display version information.
For detailed help on any command, append the command name after --help
. For example, to get help for the start
command:
PS C:\Program Files\Servy> .\servy-cli start --help
Servy.CLI 1.0.0+98dbe218852cc1ca08a0734aee4003a039dae976
Copyright © 2025 Akram El Assas. All rights reserved.
-n, --name Required. Name of the service to start.
--help Display this help screen.
--version Display version information.
The main command for installing a Windows service is install
. Here is its detailed usage:
S C:\Program Files\Servy> .\servy-cli install --help
Servy.CLI 1.0.0+d6103bb97232f378bcd5c3ac8ce4ccdc6a24d88f
Copyright © 2025 Akram El Assas. All rights reserved.
-n, --name Required. Unique service name to install.
-d, --description Description of the service.
-p, --path Required. Path to the executable process.
--startupDir Startup directory for the process.
--params Additional parameters for the process.
--startupType Service startup type. Options: Automatic, Manual, Disabled.
--priority Process priority level. Options: Idle, BelowNormal, Normal, AboveNormal,
High, RealTime.
--stdout Path to stdout log file.
--stderr Path to stderr log file.
--enableRotation Enable log rotation.
--rotationSize Log rotation size in bytes.
--enableHealth Enable health monitoring.
--heartbeatInterval Heartbeat interval in seconds.
--maxFailedChecks Maximum allowed failed health checks.
--recoveryAction Recovery action on failure. Options: None, RestartService,
RestartProcess, RestartComputer.
--maxRestartAttempts Maximum restart attempts on failure.
--env Environment variables for the process. Enter variables in the format
varName=varValue, separated by semicolons (;). Use \= to escape '=' and
\; to escape ';'. To include a literal backslash before '=' or ';', use
double backslashes (\\).
--deps Specify one or more Windows service names (not display names) that this
service depends on separated with semicolons (;). Use service key names
without spaces or special characters. Each dependency service must be
installed and running before this service can start. If a dependency's
start type is Automatic, Windows will try to start it automatically
before this service. If a dependency fails to start or is disabled, this
service will not start.
--user The service account username (e.g., .\username, DOMAIN\username).
--password The service account password.
--preLaunchPath The pre-launch executable path. Configure an optional script or
executable to run before the main service starts. This is useful for
preparing configurations, fetching secrets, or other setup tasks. If the
pre-launch script fails, the service will not start unless you enable
--preLaunchIgnoreFailure.
--preLaunchStartupDir Specifies the directory in which the pre-launch executable will start.
Defaults to the service working directory.
--preLaunchParams Additional parameters for the pre-launch executable.
--preLaunchEnv Environment variables for the pre-launch executable. Enter variables in
the format varName=varValue, separated by semicolons (;). Use \= to
escape '=' and \; to escape ';'. To include a literal backslash before
'=' or ';', use double backslashes (\\).
--preLaunchStdout Path to stdout log file of the pre-launch executable.
--preLaunchStderr Path to stderr log file of the pre-launch executable.
--preLaunchTimeout Timeout for the pre-launch executable.
--preLaunchRetryAttempts Number of retry attempts for the pre-launch executable if it fails.
Must be greater or equal to 0.
--preLaunchIgnoreFailure Ignore failure and start service even if pre-launch executable fails.
--help Display this help screen.
--version Display version information.
Below is an example usage of the install
command:
.\servy-cli install `
--name "My NodeJS Service" `
--description "My NodeJS Server" `
--path "C:\Program Files\nodejs\node.exe" `
--startupDir "C:\Apps\App" `
--params "C:\Apps\App\index.js" `
--startupType Automatic `
--priority Normal `
--stdout "C:\Apps\App\stdout.log" `
--stderr "C:\Apps\App\stderr.log" `
--enableRotation true `
--rotationSize 10485760 `
--enableHealth true `
--heartbeatInterval 10 `
--maxFailedChecks 3 `
--recoveryAction RestartService `
--maxRestartAttempts 5 `
--env "ENV_VAR1=VAL1; ENV_VAR2=VAL2;" `
--deps "MongoDB; MySQL80" `
--user ".\username" `
--password "secret"
Below is an example usage of the install
command with a pre-launch script:
.\servy-cli install `
-n MyLegacyService `
-d "Runs legacy app with dynamic config" `
-p "C:\Apps\LegacyApp\LegacyApp.exe" `
--startupDir "C:\Apps\LegacyApp" `
--params "--mode=production" `
--preLaunchPath "C:\Scripts\GenerateConfig.ps1" `
--preLaunchStartupDir "C:\Scripts" `
--preLaunchParams "-VaultUrl https://vault.example.com -SecretName AppSecrets" `
--preLaunchEnv "ENV=production;API_KEY=abcdef123" `
--preLaunchStdout "C:\Logs\prelaunch_stdout.log" `
--preLaunchStderr "C:\Logs\prelaunch_stderr.log" `
--preLaunchTimeout "60" `
--preLaunchRetryAttempts "2" `
--preLaunchIgnoreFailure `
--user ".\serviceuser" `
--password "P@ssw0rd!" `
--enableHealth `
--heartbeatInterval "30" `
--maxFailedChecks "3" `
--recoveryAction "RestartService" `
--maxRestartAttempts "5" `
--stdout "C:\Logs\service_stdout.log" `
--stderr "C:\Logs\service_stderr.log" `
--enableRotation `
--rotationSize "10485760"
-
uninstall
— Uninstall an existing service by name. -
start
— Start a Windows service by name. -
stop
— Stop a Windows service by name. -
restart
— Restart a Windows service by name. -
export
— Export a Servy Windows service configuration to a configuration file. -
import
— Import a Windows service configuration into Servy's database. -
version
— Show CLI version.
- Always run the CLI with Administrator privileges when executing commands that modify Windows services.
- Use the
--help
flag with any command to display detailed usage information and available options. - When automating with scripts or CI/CD pipelines, rely on the CLI's exit codes:
0
indicates success, any other value indicates failure. - Ensure that log file paths are writable by the user account under which the service runs to avoid permission issues.
Copyright © Akram El Assas. All rights reserved.