Newer
Older
cortex-hub / scripts / move_orphans.exp
#!/usr/bin/expect -f
set timeout 60
set password "a6163484a"

# 1. Create backup directory
spawn ssh -o StrictHostKeyChecking=no axieyangb@192.168.68.113 "mkdir -p /home/coder/project/cortex-hub/data/orphans_backup/"
expect {
    "password:" {
        send "$password\r"
        exp_continue
    }
    eof
}

# 2. Move files
set orphans {
    "/home/coder/project/cortex-hub/ai-hub-dump.db"
    "/home/coder/project/cortex-hub/ai-hub/ai-hub/test.db"
    "/home/coder/project/cortex-hub/ai-hub/ai-hub/data/ai_hub.db"
    "/home/coder/project/cortex-hub/ai-hub/app/db/data/ai_hub.db"
    "/home/coder/project/cortex-hub/ai-hub/cortex_integration_test.db"
    "/home/coder/project/cortex-hub/data/ai-hub-copy.db"
}

foreach file $orphans {
    spawn ssh -o StrictHostKeyChecking=no axieyangb@192.168.68.113 "mv $file /home/coder/project/cortex-hub/data/orphans_backup/"
    expect {
        "password:" {
            send "$password\r"
            exp_continue
        }
        eof
    }
}

# 3. Verify
spawn ssh -o StrictHostKeyChecking=no axieyangb@192.168.68.113 "ls -lh /home/coder/project/cortex-hub/data/orphans_backup/"
expect {
    "password:" {
        send "$password\r"
        exp_continue
    }
    eof
}