#!/data/data/com.termux/files/usr/bin/bash
# Termux:Boot 开机自启脚本

# 修复权限（Android 14 重启后会重置）
/system/bin/chmod +x /data/data/com.termux/files/usr/bin/* 2>/dev/null
/system/bin/chmod +x /data/data/com.termux/files/usr/libexec/* 2>/dev/null

# 启动 SSH
sshd

# 启动 OpenClaw
cd ~/.openclaw/workspace && nohup openclaw gateway run >> ~/.openclaw/gateway.log 2>&1 &

# 启动数据收集循环
nohup bash ~/.openclaw/workspace/scripts/collect-phone-data-loop.sh &>/dev/null &
