auto-sync: 2026-04-10 15:20:01
This commit is contained in:
Executable
+71
@@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Windows-Test-Node节点配置脚本
|
||||
# 用于配置Windows节点的访问权限和执行数据采集任务
|
||||
|
||||
# Windows节点信息
|
||||
WINDOWS_NODE="192.168.2.33"
|
||||
WINDOWS_USER="administrator"
|
||||
|
||||
# 配置Windows节点的SSH服务
|
||||
config_ssh() {
|
||||
echo "配置Windows节点的SSH服务..."
|
||||
# 检查Windows节点是否已启用SSH服务
|
||||
if ssh "$WINDOWS_USER@$WINDOWS_NODE" "Get-Service ssh-agent" >/dev/null 2>&1; then
|
||||
echo "SSH服务已启用"
|
||||
else
|
||||
echo "SSH服务未启用,正在启动..."
|
||||
ssh "$WINDOWS_USER@$WINDOWS_NODE" "Start-Service ssh-agent"
|
||||
ssh "$WINDOWS_USER@$WINDOWS_NODE" "Set-Service ssh-agent -StartupType Automatic"
|
||||
fi
|
||||
}
|
||||
|
||||
# 配置Windows节点的Python环境
|
||||
config_python() {
|
||||
echo "配置Windows节点的Python环境..."
|
||||
# 检查Python是否已安装
|
||||
if ssh "$WINDOWS_USER@$WINDOWS_NODE" "python --version" >/dev/null 2>&1; then
|
||||
echo "Python已安装"
|
||||
else
|
||||
echo "Python未安装,正在安装..."
|
||||
ssh "$WINDOWS_USER@$WINDOWS_NODE" "winget install Python.Python"
|
||||
fi
|
||||
}
|
||||
|
||||
# 配置Windows节点的AKShare库
|
||||
config_akshare() {
|
||||
echo "配置Windows节点的AKShare库..."
|
||||
# 检查AKShare是否已安装
|
||||
if ssh "$WINDOWS_USER@$WINDOWS_NODE" "python -c 'import akshare'" >/dev/null 2>&1; then
|
||||
echo "AKShare已安装"
|
||||
else
|
||||
echo "AKShare未安装,正在安装..."
|
||||
ssh "$WINDOWS_USER@$WINDOWS_NODE" "pip install akshare"
|
||||
fi
|
||||
}
|
||||
|
||||
# 同步代码到Windows节点
|
||||
sync_code() {
|
||||
echo "同步代码到Windows节点..."
|
||||
# 同步sanguo_quant_live项目到Windows节点
|
||||
rsync -avz --exclude='*.pyc' --exclude='__pycache__' /Users/chufeng/.openclaw/sanguo_projects/sanguo_quant_live/ "$WINDOWS_USER@$WINDOWS_NODE:/c/sanguo_quant_live/"
|
||||
}
|
||||
|
||||
# 在Windows节点上执行数据采集任务
|
||||
run_data_collection() {
|
||||
echo "在Windows节点上执行数据采集任务..."
|
||||
# 在Windows节点上执行数据采集脚本
|
||||
ssh "$WINDOWS_USER@$WINDOWS_NODE" "cd /c/sanguo_quant_live/zhaoyun-data && python scripts/akshare_downloader.py --symbols 510050 510300 --start-date 20210101 --end-date 20231231"
|
||||
}
|
||||
|
||||
# 主函数
|
||||
main() {
|
||||
config_ssh
|
||||
config_python
|
||||
config_akshare
|
||||
sync_code
|
||||
run_data_collection
|
||||
}
|
||||
|
||||
# 执行主函数
|
||||
main
|
||||
Reference in New Issue
Block a user