Unix Service Control
- Task type: ssh_checkservice
Description
The Unix Service Control task allows you to manage the state of a service or daemon on a local machine (Default mode) or on a remote server via SSH.
It enables the execution of standard service operations, such as starting, stopping, and checking status, without the need to manually specify operating system commands.
Configuration
Configuration defines the execution mode (local or remote) and the service to manage. Task configuration fields can be set manually or via workflow parameters and variables.
Server Connection
- Connection mode: Defines the source of credentials and the execution type. It can assume three operational modes:
- Default: Commands are executed on the local machine, without an SSH connection.
- Manual: Allows manual entry of SSH connection parameters.
- Environment: Uses a preconfigured connection environment. In this mode, a menu is displayed listing available connections based on the role associated with the Workflow.
- IP Address: IP address of the remote server.
- Hostname: Hostname of the remote server.
- User: Username used to establish the SSH connection.
- Password: Password associated with the connection user.
- Port: Port used for the SSH connection (the default value is 22).
Run command as another user
By enabling this checkbox, you can execute the service management command with a user different from the one used for the SSH connection.
- User: The name of the user under which the command will be executed (e.g., root).
- Password: The password for the user specified above.
Operation Details
- Operation: A menu to select the action to perform on the service:
- Status: Checks the current state of the service (e.g., active, inactive, starting).
- Start: Starts the service.
- Stop: Stops the service.
- Service Name: The name of the service to act upon, as known by the operating system (e.g., httpd, apache2, postgresql, sshd).
Output Parameters
Upon completion of execution, the task makes the following Output Parameters available, which can be used as input for subsequent tasks in the Workflow.
- result: Contains a text message describing the outcome of the operation or an error message (e.g., "Missing server address").
- resultJson: Represents the result of the task execution in JSON format, including general information, configurations, and execution details.
- exitStatus: Returns the exit code of the executed command. A value of 0 typically indicates that the operation was successful. Other codes can indicate various states (e.g., "service already stopped" or "service not found").
Notes
The task establishes an SSH connection with the remote server and executes the stop/start/status command for the specified service on the configured server. If you use SSH key authentication, the public key must be registered on the remote server. If the "Run command as another user" option is enabled, the command is executed with a user different from the main SSH connection user.