# $cs.Sys_Sleep

> Pauses script execution for the given number of seconds.

Source: https://docs.capaone.com/capainstaller/powerpacks/cs-sys-sleep/  
Product: CapaInstaller — a separate CapaSystems product; do not apply this page to any other.

### Description

Pauses script execution for the given number of seconds. The valid range is greater than 0 and less than 14400 (under 4 hours) — values outside that range are silently ignored, meaning no sleep happens at all and no error is raised.

### Syntax

$cs.Sys_Sleep(int seconds)

### Parameters

#### seconds (Integer)

Number of seconds to sleep. Must be greater than 0 and less than 14400.

### Return value

None.

### Example

**PowerShell**

Wait for a background process to settle before continuing:

```powershell
$cs.Job_WriteLog("Waiting 60 seconds for background process to settle")
$cs.Sys_Sleep(60)
```

Give a service a short grace period after restarting it before the next installer step depends on it being ready:

```powershell
$cs.Service_Stop("MyAppService")
$cs.Service_Start("MyAppService")
$cs.Job_WriteLog("Waiting 15 seconds for MyAppService to finish initializing")
$cs.Sys_Sleep(15)
```

Insert a brief pause between two dependent installer steps, such as after registering a component before configuring it:

```powershell
$cs.Job_WriteLog("Registering component, waiting briefly before configuration step")
Start-Process "regsvr32.exe" -ArgumentList "/s `"$global:Packageroot\mycomponent.dll`"" -Wait
$cs.Sys_Sleep(5)
```

### Related functions

[$cs.Sys_WaitForProcess](/capainstaller/powerpacks/cs-sys-waitforprocess/) [$cs.Sys_WaitForProcessToExist](/capainstaller/powerpacks/cs-sys-waitforprocesstoexist/)
