SUPPLIER_ID=103385
MNT=/mnt/mmcblk0p6
AGENT_PATH=$MNT/px
WORKSPACE=$MNT/.airship
mkdir -p $AGENT_PATH
wget http://down.pute.cn:7001/PuteCloud/sh/jb/airship-agent-linux-arm64-latest -O $AGENT_PATH/airship-agent-linux
chmod 777 $AGENT_PATH/airship-agent-linux

mb_machine_id=$(cat /etc/.mb_machine_id)
$AGENT_PATH/airship-agent-linux serve --workspace $WORKSPACE --class box --supplier-id $SUPPLIER_ID --supplier-device-id $mb_machine_id

KEEP_PATH=/usr/sbin/PdnTerminal/keeppai.sh
cat > $KEEP_PATH <<EOF
#!/bin/bash
while true
do
  sleep 60
  pidof airship-agent-linux >/dev/null && echo "air is running" && continue
  $AGENT_PATH/airship-agent-linux serve --workspace $WORKSPACE --class box --supplier-id $SUPPLIER_ID --supplier-device-id $mb_machine_id >/dev/null &
done
EOF
chmod +x $KEEP_PATH

echo "--create keep alive air file complete--"