Implementation:Apache Dolphinscheduler Daemon Process Management
| Knowledge Sources | |
|---|---|
| Domains | Operations, Process_Management |
| Last Updated | 2026-02-10 00:00 GMT |
Overview
Concrete shell script that manages the start, stop, and status lifecycle of all DolphinScheduler server processes.
Description
The dolphinscheduler-daemon.sh script is the primary operational tool for managing DolphinScheduler server components. It accepts a command (start, stop, or status) and a server type (api-server, master-server, worker-server, alert-server, or standalone-server). On start, it checks for an existing running process via a PID file, optionally overwrites server-specific environment configuration from bin/env/dolphinscheduler_env.sh, then launches the server via nohup. On stop, it sends kill signals with a 5-second grace period before escalating to kill -9. On status, it reports RUNNING or STOP with color-coded terminal output.
Usage
Use this script to start, stop, or check the status of any DolphinScheduler server component during deployment, operations, or development. It is the standard entry point for process lifecycle management across all server types.
Code Reference
Source Location
- Repository: Apache_Dolphinscheduler
- File: script/dolphinscheduler-daemon.sh
- Lines: 1-147
Signature
#!/bin/bash
# Usage: dolphinscheduler-daemon.sh (start|stop|status) <server-type>
#
# Server types:
# api-server, master-server, worker-server, alert-server, standalone-server
#
# Functions:
# overwrite_server_env(server) - Copies bin/env/dolphinscheduler_env.sh to server conf
# get_server_running_status() - Sets $state to "RUNNING" or "STOP" based on PID file
#
# Environment variables:
# DOLPHINSCHEDULER_HOME - Root installation directory (auto-detected)
# DOLPHINSCHEDULER_LOG_DIR - Log directory for the server
# STOP_TIMEOUT - Grace period before force-kill (default: 5s)
Import
# Invoked directly from the command line
./script/dolphinscheduler-daemon.sh start master-server
./script/dolphinscheduler-daemon.sh stop worker-server
./script/dolphinscheduler-daemon.sh status api-server
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| startStop | String (start/stop/status) | Yes | The lifecycle action to perform |
| command | String (server type) | Yes | One of: api-server, master-server, worker-server, alert-server, standalone-server |
| bin/env/dolphinscheduler_env.sh | Shell script | No | Shared environment configuration to overwrite server-specific config |
| <server>/bin/start.sh | Shell script | Yes (for start) | Server-specific startup script launched via nohup |
Outputs
| Name | Type | Description |
|---|---|---|
| PID file | File (<server>/pid) | Contains the process ID of the running server |
| Log file | File (<server>/logs/<server>-<hostname>.out) | Stdout/stderr output from the server process |
| Status output | Terminal text | Color-coded RUNNING or STOP status message |
Usage Examples
Start and Monitor a Server
# Start the master server
./script/dolphinscheduler-daemon.sh start master-server
# Check if it is running
./script/dolphinscheduler-daemon.sh status master-server
# View the log output
tail -f master-server/logs/master-server-$(hostname).out
Graceful Stop With Fallback
# Stop the worker server (5s grace period, then force-kill)
./script/dolphinscheduler-daemon.sh stop worker-server
# Verify it has stopped
./script/dolphinscheduler-daemon.sh status worker-server
Start All Servers
# Start all server components
for server in api-server master-server worker-server alert-server; do
./script/dolphinscheduler-daemon.sh start $server
done
# Check status of all
for server in api-server master-server worker-server alert-server; do
./script/dolphinscheduler-daemon.sh status $server
done