Files
FastDeploy/fastdeploy/golang_router/examples/run_with_config/run.sh
T
mouxin 0a92e96f20 [Feature] Add Golang-based Router for Request Scheduling and Load Balancing (#5882)
* [Feature] add golang router

* [Feature] add golang router

* [Feature] add golang router

* [Feature] add golang router

* [Feature] add golang router

* [Feature] Add Golang-based Router for Request Scheduling and Load Balancing

* [Feature] Add Golang-based Router for Request Scheduling and Load Balancing

* [Feature] Add Golang-based Router for Request Scheduling and Load Balancing

* [Feature] Add Golang-based Router for Request Scheduling and Load Balancing

---------

Co-authored-by: mouxin <mouxin@baidu.com>
2026-01-07 21:28:08 +08:00

24 lines
813 B
Bash

#!/bin/bash
PID=$(ps -ef | grep "fd-router" | grep -v grep | awk '{print $2}')
if [ -n "$PID" ]; then
echo "Killing existing fd-router process (PID: $PID)"
# Try graceful shutdown first
kill -15 $PID
TIMEOUT=10
while kill -0 $PID 2>/dev/null && [ $TIMEOUT -gt 0 ]; do
echo "Waiting for fd-router (PID: $PID) to exit gracefully... ($TIMEOUT seconds remaining)"
sleep 1
TIMEOUT=$((TIMEOUT - 1))
done
# Force kill if still running after timeout
if kill -0 $PID 2>/dev/null; then
echo "fd-router (PID: $PID) did not exit gracefully; sending SIGKILL..."
kill -9 $PID
fi
fi
echo "Starting new fd-router process..."
nohup ./fd-router --config_path ./config/config.yaml --splitwise > fd-router.log 2>&1 &
echo "fd-router started with PID: $!"