Get PodeService - mdaneri/Pode GitHub Wiki
Retrieves the status of a Pode service across different platforms (Windows, Linux, and macOS).
Get-PodeService [-Name] <String> [-Agent] [-ProgressAction <ActionPreference>] [<CommonParameters>]
The `Get-PodeService` function checks if a Pode-based service is running or stopped on the host system. It supports Windows (using `Get-Service`), Linux (using `systemctl`), and macOS (using `launchctl`). The function returns a consistent result across all platforms by providing the service name and status in a hashtable format. The status is mapped to common states like "Running," "Stopped," "Starting," and "Stopping."
Get-PodeService
Retrieves the current status of the Pode service defined in the `srvsettings.json` configuration file.
Get-PodeService
On Windows: @{ Name = "MyService"; Status = "Running" }
On Linux: @{ Name = "MyService"; Status = "Stopped" }
On macOS: @{ Name = "MyService"; Status = "Unknown" }
Specifies that only agent-type services should be returned. This parameter is applicable to macOS only.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
The name of the service.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
- The function reads the service name from the `srvsettings.json` file in the script's directory.
- For Windows, it uses the `Get-Service` cmdlet.
- For Linux, it uses `systemctl` to retrieve the service status.
- For macOS, it uses `launchctl` to check if the service is running.