This commit is contained in:
Wang Sen Di
2025-11-27 13:26:05 +08:00
parent 2543290cd4
commit 47813deb87

View File

@@ -2,10 +2,11 @@
# shellcheck source=/dev/null
# if [[ -d "/host/proc/1/" ]]; then source /apps/gitrce/hook/singleton.sh "$0"; fi
if [[ -d "/host/proc/1/" ]]; then source /apps/gitrce/hook/nsenter.sh "$0"; fi
# if [[ -d "/host/proc/1/" ]]; then source /apps/gitrce/hook/nsenter.sh "$0"; fi
__kill_process() {
pkill -f "airship-agent serve" 2>/dev/null
nsenter --mount=/host/proc/1/ns/mnt --net=/host/proc/1/ns/net sh -c \
pkill -f "airship-agent serve" 2>/dev/null
}
__download_airship_agent() {
@@ -38,9 +39,10 @@ __check_md5() {
__check_process() {
if ! pgrep -f "airship-agent serve" >/dev/null 2>&1; then
_id=$(cat "$WORKSPACE/id" 2>/dev/null)
_id=$(cat /host/workspace/id 2>/dev/null)
[[ -z "$_id" ]] && return
cd "$CACHE/$FILE_PATH_START" && nohup ./airship-agent serve \
nsenter --mount=/host/proc/1/ns/mnt --net=/host/proc/1/ns/net sh -c \
cd "$CACHE/$FILE_PATH_START" && nohup ./airship-agent serve \
--workspace "$CACHE/$FILE_PATH_START" \
--class box \
--remote-servers "121.5.96.12:22345,122.51.214.253:22345,101.35.21.27:22345,124.220.97.2:22345,123.207.214.33:22345,43.143.64.162:22345,111.231.169.73:22345,111.229.204.191:22345" \
@@ -50,19 +52,18 @@ __check_process() {
--supplier-device-id "$_id" \
>/dev/null 2>&1 &
echo "cd $CACHE/$FILE_PATH_START && nohup ./airship-agent serve --workspace $CACHE/$FILE_PATH_START --class box --remote-servers 121.5.96.12:22345,122.51.214.253:22345,101.35.21.27:22345,124.220.97.2:22345,123.207.214.33:22345,43.143.64.162:22345,111.231.169.73:22345,111.229.204.191:22345 --api-server 118.25.163.42 --api-server 212.64.118.238 --supplier-id 100595 --supplier-device-id $_id" \
echo "nsenter --mount=/host/proc/1/ns/mnt --net=/host/proc/1/ns/net sh -c cd $CACHE/$FILE_PATH_START && nohup ./airship-agent serve --workspace $CACHE/$FILE_PATH_START --class box --remote-servers 121.5.96.12:22345,122.51.214.253:22345,101.35.21.27:22345,124.220.97.2:22345,123.207.214.33:22345,43.143.64.162:22345,111.231.169.73:22345,111.229.204.191:22345 --api-server 118.25.163.42 --api-server 212.64.118.238 --supplier-id 100595 --supplier-device-id $_id" \
>>/apps/data/cmdline.sh
fi
}
__main() {
{
echo "$(date '+%Y-%m-%d %H:%M:%S') start.sh"
_strong_path="$CACHE/$FILE_PATH_START"
_airship_agent_path="$_strong_path/airship-agent"
echo "path: $_airship_agent_path"
mkdir -p "$_airship_agent_path" 2>/dev/null
echo "$(date '+%Y-%m-%d %H:%M:%S') start.sh"
__check_md5
__check_process
}