Skip to content

Service Dependencies

Akram El Assas edited this page Sep 14, 2025 · 34 revisions

Servy supports optional service dependencies, allowing a service to start only after one or more other Windows services are running.
Enter each dependent service by its service name (not the display name) on a new line or separate them with semicolons (;).

This ensures that your service starts in the correct order and avoids errors if required services are not yet running.

CLI Option: --deps

The --deps command-line option lets you specify one or more Windows service dependencies when installing a service via the CLI.

  • Syntax: --deps "Service1; Service2; Service3"
  • Servy will wait for all specified services to be running before starting the main service.
  • Multiple dependencies can be separated with semicolons or listed on separate lines in the configuration file.
  • This is especially useful for applications that rely on databases, message brokers, or other background services.

CLI Example

.\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 `
  --rotationSize 10485760 `
  --enableHealth `
  --heartbeatInterval 10 `
  --maxFailedChecks 3 `
  --recoveryAction RestartService `
  --maxRestartAttempts 5 `
  --env "ENV_VAR1=VAL1; ENV_VAR2=VAL2;" `
  --deps "MongoDB; MySQL80" `
  --user ".\username" `
  --password "secret"

Tip: You can combine service dependencies with pre-launch scripts and health checks to ensure that your service starts reliably in complex environments.

Clone this wiki locally