### Servy CLI Install Command Example Source: https://github.com/defiect/servy-wiki/blob/master/Servy-CLI.md This PowerShell example demonstrates how to install a new service using the Servy CLI. It configures various service settings such as name, description, executable path, startup directory, parameters, startup type, priority, logging, log rotation, and health checks. ```powershell servy-cli install \ --quiet \ --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 \ --rotationSize=10485760 \ --enableHealth \ ``` -------------------------------- ### Install Service with Dependencies Source: https://context7.com/defiect/servy-wiki/llms.txt Installs a service and configures its startup dependencies. The service will only start after all specified dependent services are running. Dependencies are listed by their service names, separated by semicolons. ```powershell servy-cli install \ --name="MyWebApp" \ --description="Web app requiring database and cache" \ --path="C:\Program Files\nodejs\node.exe" \ --params="C:\apps\webapp\server.js" \ --startupDir="C:\apps\webapp" \ --startupType="Automatic" \ --deps="MongoDB;Redis;MySQL80" ``` -------------------------------- ### Install Service with Post-Launch Script Configuration Source: https://context7.com/defiect/servy-wiki/llms.txt Installs a service and configures a post-launch script to execute after the main service has started successfully. This is useful for tasks like sending notifications or initializing dependent processes. The script runs asynchronously. ```powershell servy-cli install \ --name="MyService" \ --description="Service with post-launch notification" \ --path="C:\Apps\App\App.exe" \ --startupDir="C:\Apps\App" \ --params="--mode=production" \ --postLaunchPath="C:\Scripts\Notify.ps1" \ --postLaunchStartupDir="C:\Scripts" \ --postLaunchParams="-Message 'Service started successfully'" ``` -------------------------------- ### Install Services for Various Languages using Servy CLI Source: https://context7.com/defiect/servy-wiki/llms.txt Examples of using the Servy CLI to install services for applications written in Node.js, Python, Java, .NET, Go, Docker, and PowerShell. These commands specify the application's executable, parameters, startup directory, and startup type. ```powershell # Node.js/Express application servy-cli install \ --name="NodeAPI" \ --path="C:\\Program Files\\nodejs\\node.exe" \ --params="C:\\apps\\api\\server.js" \ --startupDir="C:\\apps\\api" \ --startupType="Automatic" # Python script servy-cli install \ --name="PythonWorker" \ --path="C:\\Python311\\python.exe" \ --params="C:\\apps\\worker\\job.py" \ --startupDir="C:\\apps\\worker" \ --startupType="Automatic" # Java JAR (Spring Boot) servy-cli install \ --name="SpringBootApp" \ --path="C:\\Program Files\\Java\\jdk-21\\bin\\java.exe" \ --params="-jar C:\\apps\\springboot\\app.jar" \ --startupDir="C:\\apps\\springboot" \ --startupType="Automatic" # .NET application (DLL with dotnet runtime) servy-cli install \ --name="DotNetWorker" \ --path="C:\\Program Files\\dotnet\\dotnet.exe" \ --params="C:\\apps\\worker\\app.dll" \ --startupDir="C:\\apps\\worker" \ --startupType="Automatic" # Go compiled binary servy-cli install \ --name="GoService" \ --path="C:\\apps\\go-app\\server.exe" \ --params="--port=8080 --mode=production" \ --startupDir="C:\\apps\\go-app" \ --startupType="Automatic" # Docker container servy-cli install \ --name="DockerService" \ --path="C:\\Program Files\\Docker\\Docker\\resources\\bin\\docker.exe" \ --params="run --rm --name myapp -p 8080:80 myimage:latest" \ --startupDir="C:\\Program Files\\Docker\\Docker\\resources\\bin" \ --startupType="Automatic" # PowerShell script servy-cli install \ --name="PSScript" \ --path="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" \ --params='-File \"C:\\scripts\\automation.ps1\"' \ --startupDir="C:\\scripts" \ --startupType="Automatic" ``` -------------------------------- ### GitHub Actions Workflow for Servy Service Management Source: https://github.com/defiect/servy-wiki/blob/master/Servy-Automation-and-CI-CD.md A comprehensive GitHub Actions workflow example for a Windows runner that installs Servy via WinGet, verifies its installation, installs a custom application as a Windows service using Servy CLI, starts the service, and checks its status. ```yaml name: Install MyApp with Servy on: workflow_dispatch: jobs: test-servy: runs-on: windows-latest steps: - name: Install Servy via WinGet run: | winget install --id aelassas.Servy -e --accept-package-agreements --accept-source-agreements --silent shell: powershell - name: Verify Servy CLI installed run: | & "C:\Program Files\Servy\servy-cli.exe" --version --quiet shell: powershell - name: Install MyApp as a Windows Service run: | & "C:\Program Files\Servy\servy-cli.exe" install \ --quiet \ --name="MyApp" \ --path="C:\MyApp\MyApp.exe" \ --startupType="Automatic" \ --startupDir="C:\MyApp\" shell: powershell - name: Start MyApp service run: | & "C:\Program Files\Servy\servy-cli.exe" start --quiet --name "MyApp" shell: powershell - name: Verify service status run: | Get-Service -Name MyApp shell: powershell ``` -------------------------------- ### Install Service with Pre-Launch Script Configuration Source: https://context7.com/defiect/servy-wiki/llms.txt Installs a service and configures a pre-launch script to execute before the main service starts. This script can be used for tasks like fetching secrets or generating configurations. The script runs synchronously and can block service startup if it fails, unless 'preLaunchIgnoreFailure' is set. ```powershell servy-cli install \ --name="MyLegacyService" \ --description="Runs legacy app with dynamic config" \ --path="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 ``` -------------------------------- ### GitHub Actions CI/CD Workflow for Deploying Windows Services Source: https://context7.com/defiect/servy-wiki/llms.txt A GitHub Actions workflow demonstrating automated deployment of Windows services using the Servy CLI. It includes steps for installing Servy via WinGet, verifying the installation, installing the application as a service, starting the service, and verifying its status. ```yaml name: Deploy Windows Service on: workflow_dispatch: jobs: deploy-service: runs-on: windows-latest steps: - name: Install Servy via WinGet run: | winget install --id aelassas.Servy -e --accept-package-agreements --accept-source-agreements --silent shell: powershell - name: Verify Servy CLI installed run: | & "C:\\Program Files\\Servy\\servy-cli.exe" --version --quiet shell: powershell - name: Install application as Windows Service run: | & "C:\\Program Files\\Servy\\servy-cli.exe" install \ --quiet \ --name="MyApp" \ --path="C:\\MyApp\\MyApp.exe" \ --startupType="Automatic" \ --startupDir="C:\\MyApp\" \ --enableHealth \ --heartbeatInterval="30" \ --recoveryAction="RestartService" shell: powershell - name: Start service run: | & "C:\\Program Files\\Servy\\servy-cli.exe" start --quiet --name "MyApp" shell: powershell - name: Verify service status run: | Get-Service -Name MyApp shell: powershell ``` -------------------------------- ### Install Node.js App as a Service (PowerShell) Source: https://github.com/defiect/servy-wiki/blob/master/Examples-and-Recipes.md Installs a Node.js application, such as an Express or Next.js app, as a Windows service. Requires Node.js to be installed. The command specifies the service name, description, path to the Node.js executable, parameters (script file or 'start' for npm), working directory, and startup type. ```powershell servy-cli install ` --name="MyNodeApp" ` --description="Node.js Express API" ` --path="C:\Program Files\nodejs\node.exe" ` --params="C:\apps\myapp\server.js" ` --startupDir="C:\apps\myapp" ` --startupType="Automatic" ``` ```powershell servy-cli install ` --name="MyNodeApp" ` --description="Node.js App via npm" ` --path="C:\Program Files\nodejs\npm.cmd" ` --params="start" ` --startupDir="C:\apps\myapp" ` --startupType="Automatic" ``` ```powershell servy-cli install ` --name="MyNextApp" ` --description="Next.js App" ` --path="C:\Program Files\nodejs\npm.cmd" ` --params="start" ` --startupDir="C:\apps\myapp" ` --startupType="Automatic" ``` -------------------------------- ### Install Deno App as a Service (PowerShell) Source: https://github.com/defiect/servy-wiki/blob/master/Examples-and-Recipes.md Installs a Deno script or HTTP server as a Windows service. Requires Deno to be installed. The command specifies the service name, description, path to the Deno executable, parameters including necessary flags (e.g., --allow-net), working directory, and startup type. ```powershell servy-cli install ` --name="MyDenoService" ` --description="Deno background script" ` --path="C:\tools\deno\deno.exe" ` --params="run --allow-net C:\apps\deno\worker.ts" ` --startupDir="C:\apps\deno" ` --startupType="Automatic" ``` -------------------------------- ### TeamCity Integration with Servy CLI Source: https://github.com/defiect/servy-wiki/blob/master/Servy-Automation-and-CI-CD.md Provides an example of using Servy CLI commands within a TeamCity build step to automate the installation and starting of Windows services. It highlights the use of `--quiet` for CI environments. ```shell servy-cli install --quiet --name="MyAp" --path="C:\TeamCity\Builds\MyApp.exe" --startupType="Automatic" servy-cli start --quiet --name="MyApp" ``` -------------------------------- ### Install Service with Health Monitoring (PowerShell) Source: https://github.com/defiect/servy-wiki/blob/master/Monitoring-and-Health-Checks.md Example of installing a service using the Servy CLI with health monitoring enabled. This command configures the service name, description, executable path, startup directory, parameters, startup type, and various health monitoring settings like heartbeat interval, maximum failed checks, recovery action, and maximum restart attempts. ```powershell .\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" ` --enableHealth ` --heartbeatInterval="10" ` --maxFailedChecks="3" ` --recoveryAction="RestartService" ` --maxRestartAttempts="5" ` ``` -------------------------------- ### Install Erlang Script as Service using Servy CLI Source: https://github.com/defiect/servy-wiki/blob/master/Examples-and-Recipes.md Installs an Erlang application to run as a Windows service. Requires Erlang runtime. The `path` parameter points to `erl.exe` and `params` are Erlang runtime arguments to start the application. ```powershell servy-cli install \ --name="MyErlangService" \ --description="Erlang background worker" \ --path="C:\Program Files\erl-25.3\bin\erl.exe" \ --params="-noshell -s my_app start -s init stop" \ --startupDir="C:\apps\erlang" \ --startupType="Automatic" ``` -------------------------------- ### Install Servy using Package Managers Source: https://context7.com/defiect/servy-wiki/llms.txt Installs Servy using common Windows package managers. Ensure the respective package manager (winget, choco, or scoop) is installed and configured on your system. ```shell # WinGet installation winget install servy ``` ```shell # Chocolatey installation choco install -y servy ``` ```shell # Scoop installation scoop bucket add extras scoop install servy ``` -------------------------------- ### Install Compiled OCaml App as Service using Servy CLI Source: https://github.com/defiect/servy-wiki/blob/master/Examples-and-Recipes.md Installs a compiled OCaml native executable to run as a Windows service. The `path` parameter directly points to the executable file. ```powershell servy-cli install \ --name="MyOCamlService" \ --description="OCaml compiled worker" \ --path="C:\apps\ocaml\worker.exe" \ --startupDir="C:\apps\ocaml" \ --startupType="Automatic" ``` -------------------------------- ### Install OCaml Script as Service using Servy CLI Source: https://github.com/defiect/servy-wiki/blob/master/Examples-and-Recipes.md Installs an OCaml script to run as a Windows service. Requires OCaml interpreter and the script path. The `path` parameter points to `ocaml.exe` and `params` points to the `.ml` script. ```powershell servy-cli install \ --name="MyOCamlService" \ --description="OCaml background worker" \ --path="C:\OCaml\bin\ocaml.exe" \ --params="C:\apps\ocaml\worker.ml" \ --startupDir="C:\apps\ocaml" \ --startupType="Automatic" ``` -------------------------------- ### Install Zig App as Service using Servy CLI Source: https://github.com/defiect/servy-wiki/blob/master/Examples-and-Recipes.md Installs a Zig application executable to run as a Windows service. The `path` parameter specifies the location of the compiled Zig executable. ```powershell servy-cli install \ --name="MyZigService" \ --description="Zig background worker" \ --path="C:\apps\zig\myapp.exe" \ --startupDir="C:\apps\zig" \ --startupType="Automatic" ``` -------------------------------- ### Package Manager Installation of Servy Source: https://github.com/defiect/servy-wiki/blob/master/Servy-Automation-and-CI-CD.md Demonstrates how to install Servy using common Windows package managers: WinGet, Chocolatey, and Scoop. These methods simplify dependency management and installation in automated environments. ```shell winget install servy ``` ```shell choco install -y servy ``` ```shell scoop bucket add extras scoop install servy ``` -------------------------------- ### Install Pascal/Delphi App as Service using Servy CLI Source: https://github.com/defiect/servy-wiki/blob/master/Examples-and-Recipes.md Installs a Pascal or Delphi application executable to run as a Windows service. The `path` parameter points to the compiled executable. ```powershell servy-cli install \ --name="MyPascalService" \ --description="Delphi background app" \ --path="C:\apps\pascal\worker.exe" \ --startupDir="C:\apps\pascal" \ --startupType="Automatic" ``` -------------------------------- ### Install Fortran App as Service using Servy CLI Source: https://github.com/defiect/servy-wiki/blob/master/Examples-and-Recipes.md Installs a Fortran application executable to run as a Windows service. The `path` parameter specifies the location of the compiled Fortran executable. ```powershell servy-cli install \ --name="MyFortranService" \ --description="Fortran computational service" \ --path="C:\apps\fortran\worker.exe" \ --startupDir="C:\apps\fortran" \ --startupType="Automatic" ``` -------------------------------- ### Install Elixir Script as Service using Servy CLI Source: https://github.com/defiect/servy-wiki/blob/master/Examples-and-Recipes.md Installs an Elixir script to run as a Windows service. Requires Elixir runtime and the script path. The `path` parameter points to `elixir.bat` and `params` points to the `.exs` script. ```powershell servy-cli install \ --name="MyElixirService" \ --description="Elixir background worker" \ --path="C:\Program Files\Elixir\bin\elixir.bat" \ --params="C:\apps\elixir\worker.exs" \ --startupDir="C:\apps\elixir" \ --startupType="Automatic" ``` -------------------------------- ### Install Lua Script as Service Source: https://github.com/defiect/servy-wiki/blob/master/Examples-and-Recipes.md Installs a Lua script to run as a Windows service for automation or background tasks. Ensure the Lua interpreter path and the script path are correctly set. ```powershell servy-cli install \ --name="MyLuaService" \ --description="Lua automation script" \ --path="C:\Lua\5.4\lua.exe" \ --params="C:\apps\lua\script.lua" \ --startupDir="C:\apps\lua" \ --startupType="Automatic" ``` -------------------------------- ### Install AutoHotkey Script as Service Source: https://github.com/defiect/servy-wiki/blob/master/Examples-and-Recipes.md Installs an AutoHotkey script to run as a Windows service. This is suitable for background automation tasks that do not require desktop interaction. Ensure the AutoHotkey executable and script path are correct. ```powershell servy-cli install \ --name="MyAutoHotkeyService" \ --description="Batch automation job" \ --path="C:\Program Files\AutoHotkey\v2\AutoHotkey.exe" \ --params="C:\scripts\service.ahk" \ --startupDir="C:\scripts" \ --startupType="Automatic" ``` -------------------------------- ### Install and Start Servy Application with Azure DevOps PowerShell Task Source: https://github.com/defiect/servy-wiki/blob/master/Servy-Automation-and-CI-CD.md This snippet demonstrates how to use the servy-cli within an Azure DevOps PowerShell task to install and start a Windows service. It utilizes the Build.ArtifactStagingDirectory for artifact placement and configures the service to start automatically. Ensure the servy-cli is accessible within the pipeline environment. ```powershell servy-cli install --quiet --name="MyApp" --path="$(Build.ArtifactStagingDirectory)\MyApp.exe" --startupType="Automatic" servy-cli start --quiet --name="MyApp" ``` -------------------------------- ### Servy CLI Install Command Usage Source: https://github.com/defiect/servy-wiki/blob/master/Servy-CLI.md This snippet shows the help output for the 'servy-cli install' command, detailing all available options for configuring a Windows service. It covers basic settings like name, display name, description, and executable path, as well as advanced options for startup parameters, logging, health checks, and recovery. ```powershell PS> servy-cli install --help Servy.CLI 4.0.0+2803e7f199fecf937d0830a5aa71deb90c324521 Copyright © 2025 Akram El Assas. All rights reserved. -n, --name Required. Unique service name to install. --displayName The human-readable name shown in the Windows Services console (services.msc). If left empty, the service name will be used instead. -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. Supports environment variable expansion, example: --param="%ProgramData%\MyApp" --param="%MY_VAR%\bin" --startupType Service startup type. Options: Automatic, AutomaticDelayedStart, 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 Deprecated. Enable size-based log rotation. This option is kept only for backward compatibility. Use --enableSizeRotation instead. --enableSizeRotation Enable size-based log rotation. --rotationSize Log rotation size in Megabytes (MB). Must be greater than or equal to 1 MB. --enableDateRotation Enable date-based log rotation based on the date interval specified by --dateRotationType. When both size-based and date-based rotation are enabled, size rotation takes precedence. --dateRotationType Date rotation type. Options: Daily, Weekly, Monthly. --maxRotations Maximum rotated log files to keep. Set to 0 or leave empty for unlimited. --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. Restart service and restart computer actions are not available if the service runs under NT AUTHORITY\NetworkService, NT AUTHORITY\LocalService, or a user account without the required privileges. Only the restart process action will be available for these accounts. --maxRestartAttempts Maximum restart attempts on failure. --failureProgramPath The failure program path. Configure a script or executable to run when the process fails to start. If health monitoring is disabled, the program will run when the process fails to start. If health monitoring is enabled, the program will only run after all configured recovery action retries have failed. --failureProgramStartupDir Specifies the directory in which the failure program will start. Defaults to the failure program directory. --failureProgramParams Additional parameters for the failure program. --env Environment variables for the process. Enter variables in the format varName=varValue separated by semicolons (;). Use \= to escape '=', \" to escape '"', \; to escape ';' and \\ to escape '\'. Supports environment variable expansion, example: VAR1=%ProgramData%\MyApp; VAR2=%VAR1%\bin --deps Specify one or more Windows service names (not display names) that this service depends on separated with semicolons (;). Use service key ``` -------------------------------- ### Install Service with Dependencies (CLI) Source: https://github.com/defiect/servy-wiki/blob/master/Service-Dependencies.md Installs a Windows service using the Servy CLI, specifying service dependencies. The `--deps` option takes a semicolon-separated string of service names. Servy will ensure all listed dependencies are running before starting the installed service. ```powershell $.\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" \ --deps="MongoDB; MySQL80" \ ``` -------------------------------- ### Configure Post-Launch Script with Servy CLI Source: https://github.com/defiect/servy-wiki/blob/master/Pre-Launch-and-Post-Launch-Actions.md This example shows how to configure a post-launch script for a Servy service using the command-line interface. It includes the executable path, startup directory, and parameters for the post-launch script. ```powershell ./servy-cli install ` -n="MyService" ` -d="Runs app with dynamic config" ` -p="C:\Apps\App\App.exe" ` --startupDir="C:\Apps\App" ` --params="--mode=production" ` --postLaunchPath="C:\Scripts\Notify.ps1" ` --postLaunchStartupDir="C:\Scripts" ` --postLaunchParams="-VaultUrl https://vault.example.com -SecretName AppSecrets" ` ``` -------------------------------- ### Configure Pre-Launch Script with Servy CLI Source: https://github.com/defiect/servy-wiki/blob/master/Pre-Launch-and-Post-Launch-Actions.md This example demonstrates how to configure a pre-launch script for a Servy service using the command-line interface. It specifies the executable path, startup directory, parameters, environment variables, logging, timeout, retry attempts, and failure handling. ```powershell ./servy-cli install ` -n="MyService" ` -d="Runs app with dynamic config" ` -p="C:\Apps\App\App.exe" ` --startupDir="C:\Apps\App" ` --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 ` ``` -------------------------------- ### Install-ServyService Source: https://github.com/defiect/servy-wiki/blob/master/Servy-PowerShell-Module.md Installs a new Windows service with the specified parameters. This cmdlet allows for extensive configuration of the service, including its name, display name, description, startup type, process priority, logging, health checks, recovery actions, environment variables, dependencies, and pre/post-launch actions. ```APIDOC ## Install-ServyService ### Description Installs a new Windows service with the specified parameters. ### Method POST (Conceptual - This is a command-line cmdlet, not a REST API endpoint) ### Endpoint N/A (Cmdlet) ### Parameters #### Cmdlet Parameters - **-Quiet** (switch, optional) - Suppresses confirmation prompts. - **-Name** (string, **required**) - The name of the service. - **-DisplayName** (string, optional) - The display name of the service. - **-Description** (string, optional) - The description of the service. - **-Path** (string, **required**) - The full path to the executable file for the service. - **-StartupDir** (string, optional) - The working directory for the service. - **-Params** (string, optional) - Command-line arguments to pass to the service executable. - **-StartupType** (string, optional) - The startup type for the service. Possible values: `Automatic`, `Manual`, `Disabled`. - **-ProcessPriority** (string, optional) - The process priority for the service. Possible values: `Idle`, `BelowNormal`, `Normal`, `AboveNormal`, `High`, `RealTime`. - **-StdoutPath** (string, optional) - Path to the standard output log file. - **-StderrPath** (string, optional) - Path to the standard error log file. - **-EnableRotation** (switch, optional) - Enables log rotation. - **-EnableSizeRotation** (switch, optional) - Enables log rotation based on size. - **-RotationSize** (int, optional) - The maximum size of a log file before rotation (in bytes). - **-EnableDateRotation** (switch, optional) - Enables log rotation based on date. - **-DateRotationType** (string, optional) - The type of date-based rotation. Possible values: `Daily`, `Weekly`, `Monthly`. - **-MaxRotations** (int, optional) - The maximum number of log files to keep. - **-EnableHealth** (switch, optional) - Enables health checking for the service. - **-HeartbeatInterval** (int, optional) - The interval (in seconds) for health check heartbeats. - **-MaxFailedChecks** (int, optional) - The maximum number of failed health checks before triggering a recovery action. - **-RecoveryAction** (string, optional) - The action to take upon service failure. Possible values: `None`, `RestartService`, `RestartProcess`, `RestartComputer`. - **-MaxRestartAttempts** (int, optional) - The maximum number of times to attempt restarting the service after failure. - **-FailureProgramPath** (string, optional) - Path to a program to run on failure. - **-FailureProgramStartupDir** (string, optional) - Working directory for the failure program. - **-FailureProgramParams** (string, optional) - Command-line arguments for the failure program. - **-EnvironmentVariables** (string, optional) - Environment variables for the service (e.g., `"VAR1=value1;VAR2=value2"`). - **-ServiceDependencies** (string, optional) - Comma-separated list of service names that this service depends on. - **-User** (string, optional) - The user account to run the service under. - **-Password** (string, optional) - The password for the user account. - **-PreLaunchPath** (string, optional) - Path to a program to run before launching the service. - **-PreLaunchStartupDir** (string, optional) - Working directory for the pre-launch program. - **-PreLaunchParams** (string, optional) - Command-line arguments for the pre-launch program. - **-PreLaunchEnv** (string, optional) - Environment variables for the pre-launch program. - **-PreLaunchStdout** (string, optional) - Path to the standard output log file for the pre-launch program. - **-PreLaunchStderr** (string, optional) - Path to the standard error log file for the pre-launch program. - **-PreLaunchTimeout** (int, optional) - Timeout (in seconds) for the pre-launch program. - **-PreLaunchRetryAttempts** (int, optional) - Number of retry attempts for the pre-launch program. - **-PreLaunchIgnoreFailure** (switch, optional) - Ignore failures of the pre-launch program. - **-PostLaunchPath** (string, optional) - Path to a program to run after launching the service. - **-PostLaunchStartupDir** (string, optional) - Working directory for the post-launch program. - **-PostLaunchParams** (string, optional) - Command-line arguments for the post-launch program. - **-EnableDebugLogs** (switch, optional) - Enables debug logging for the service installation process. ### Request Example ```powershell Install-ServyService -Name "MyService" -Path "C:\path\to\my\service.exe" -Description "My custom service" -StartupType Automatic ``` ### Response #### Success Response (0) (Cmdlet execution success) #### Response Example (No specific output on success, but errors will be displayed if they occur.) ``` -------------------------------- ### Install Windows Service with Servy CLI Source: https://github.com/defiect/servy-wiki/blob/master/Servy-CLI.md Installs a new Windows service using the Servy CLI. This command supports various configuration options including service details, startup parameters, pre-launch scripts, environment variables, logging, and health checks. It requires Administrator privileges for execution. ```powershell servy-cli install \ --quiet \ --name="MyLegacyService" \ --description="Runs legacy app with dynamic config" \ --path="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" ``` -------------------------------- ### Install a Windows Service with Servy Source: https://github.com/defiect/servy-wiki/blob/master/Servy-PowerShell-Module.md Installs a new Windows service using the `Install-ServyService` cmdlet. It requires parameters such as the service name, description, executable path, startup directory, parameters for the executable, and the desired startup type. The `-Quiet` option suppresses interactive prompts. ```powershell Install-ServyService ` -Quiet ` -Name "WexflowServer" ` -Description "Wexflow Workflow Engine" ` -Path "C:\Program Files\dotnet\dotnet.exe" ` -StartupDir "C:\Program Files\Wexflow Server\Wexflow.Server" ` -Params "Wexflow.Server.dll" ` -StartupType "Automatic" ``` -------------------------------- ### Servy CLI Service Management Commands Source: https://github.com/defiect/servy-wiki/blob/master/Servy-Automation-and-CI-CD.md Illustrates fundamental Servy CLI commands for managing Windows services, including installation, starting, stopping, and uninstallation. These commands are essential for programmatic control of services. ```shell # Install or update a service servy-cli install --name="MyApp" --path="C:\MyApp\MyApp.exe" --startupType="Automatic" # Start a service servy-cli start --name="MyApp" # Stop a service servy-cli stop --name="MyApp" # Uninstall a service servy-cli uninstall --name="MyApp" ``` -------------------------------- ### Manage Services using Servy PowerShell Module Source: https://context7.com/defiect/servy-wiki/llms.txt Provides cmdlets for managing Windows services within PowerShell workflows. Includes installing, starting, stopping, restarting, and checking the status of services. The module needs to be imported first. ```powershell # Import the module Import-Module "C:\Program Files\Servy\Servy.psm1" -Force # Display version Show-ServyVersion -Quiet # Install a new service Install-ServyService ` -Quiet ` -Name "WexflowServer" ` -Description "Wexflow Workflow Engine" ` -Path "C:\Program Files\dotnet\dotnet.exe" ` -StartupDir "C:\Program Files\Wexflow Server\Wexflow.Server" ` -Params "Wexflow.Server.dll" ` -StartupType "Automatic" ` -EnableHealth ` -HeartbeatInterval 30 ` -MaxFailedChecks 3 ` -RecoveryAction "RestartService" # Service lifecycle management Start-ServyService -Quiet -Name "WexflowServer" Get-ServyServiceStatus -Quiet -Name "WexflowServer" # Returns: Running, Stopped, etc. Stop-ServyService -Quiet -Name "WexflowServer" Restart-ServyService -Quiet -Name "WexflowServer" ``` -------------------------------- ### Silent Installation of Servy Installer Source: https://context7.com/defiect/servy-wiki/llms.txt Performs a silent installation of the Servy installer executable. This method is useful for automated deployments where user interaction should be minimized. It suppresses messages and restarts. ```powershell .\servy-1.9-x64-installer.exe /VERYSILENT /NORESTART /SUPPRESSMSGBOXES /SP- /CLOSEAPPLICATIONS /NOCANCEL ``` -------------------------------- ### Install Service using Servy CLI for CI/CD Source: https://github.com/defiect/servy-wiki/blob/master/Integration-with-Monitoring-Tools.md This PowerShell script demonstrates how to install a service using the Servy CLI. It configures service name, description, executable path, startup parameters, logging, health checks, and recovery actions, making it suitable for CI/CD pipelines. ```powershell .\servy-cli install \ --name "MyNodeApp" \ --description "Node.js API Service" \ --path "C:\Program Files\nodejs\node.exe" \ --startupDir "C:\Apps\MyNodeApp" \ --params "C:\Apps\MyNodeApp\server.js" \ --startupType Automatic \ --enableHealth \ --heartbeatInterval 10 \ --maxFailedChecks 3 \ --recoveryAction RestartService \ --stdout "C:\Logs\MyNodeApp_stdout.log" \ --stderr "C:\Logs\MyNodeApp_stderr.log" \ --enableRotation \ --rotationSize 10485760 ``` -------------------------------- ### Silent Installation via PowerShell Source: https://context7.com/defiect/servy-wiki/llms.txt Initiates a silent installation of the Servy installer using PowerShell, running with elevated privileges. This command is designed for unattended installations in script-based deployment scenarios. ```powershell Start-Process -FilePath ".\servy-1.9-x64-installer.exe" ` -ArgumentList '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP- /CLOSEAPPLICATIONS /NOCANCEL' ` -Verb RunAs -Wait ``` -------------------------------- ### Silent Installation of Servy Executables Source: https://github.com/defiect/servy-wiki/blob/master/Servy-Automation-and-CI-CD.md Provides commands for performing silent installations of Servy using its Windows installer executables. These commands are suitable for automated deployments where user interaction should be suppressed. ```batch .\servy-2.2-x64-installer.exe /VERYSILENT /NORESTART /SUPPRESSMSGBOXES /SP- .\servy-2.2-net48-x64-installer.exe /VERYSILENT /NORESTART /SUPPRESSMSGBOXES /SP- ```