Projects
Eulaceura:Factory
systemabilitymgr_safwk
_service:obs_scm:stop_services.sh
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:stop_services.sh of Package systemabilitymgr_safwk
#!/bin/bash # 停止所有启动的分布式服务 # 使用方法: # 1. 暂停所有服务:./stop_services.sh all # 2. 暂替某个服务:./stop_services.sh [samgr|huks|deviceauth|softbus|dm|dfs|datamgr] # 定义map,保存参数和对应执行的shell命令 declare -A COMMAND_MAP=( ["datamgr"]="pkill -f distributeddata" ["dfs"]="pkill -f distributedfile" ["dm"]="pkill -f device_manager" ["softbus"]="pkill -f softbus_server" ["deviceauth"]="pkill -f deviceauth_service" ["huks"]="pkill -f huks_service" ["samgr"]="pkill -f samgr" ) # 日志打印函数 log() { case $1 in error) echo "[ERROR] $2" ;; info) echo "[INFO] $2" ;; debug) if [ "$DEBUG_MODE" == "true" ]; then echo "[DEBUG] $2" fi ;; *) echo "Invalid log level: $1" ;; esac } # 判断参数是否为空 if [ -z "$1" ]; then log error "Usage: $0 [all|samgr|huks|deviceauth|softbus|dm|dfs|datamgr]" exit 1 fi # 验证参数并执行相应命令 if [ "$1" == "all" ]; then log info "Stop all services..." for key in "${!COMMAND_MAP[@]}"; do log info "Stop $key service..." # 执行命令 eval ${COMMAND_MAP[$key]} done else if [ "${COMMAND_MAP[$1]+isset}" ]; then log info "Stop $1 service..." # 执行命令 eval ${COMMAND_MAP[$1]} else log error "Invalid parameter: $1" exit 1 fi fi log info "Done."
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2