0%

无法通过ssh命令在windows上启动GUI或者exe服务

无法通过ssh命令在windows上启动GUI或者exe服务

通过schtasks方创建任务去执行

1
2
3
4
5
6
@echo "开始通过schtasks启动test。。。"
schtasks /create /SC ONCE /TN test-build /TR C:\server\windows-bat-code\start-test.bat /ST 00:00
schtasks /run /TN test-build
schtasks /delete /TN test-build /F
exit 0

start-test.bat
启动git-bash命令执行

1
2
3
@echo "开始启动test。。。"
start "" "C:\Program Files\Git\git-bash.exe" -c "cd /c/server/test-3d/build && export BUILD_ID=dontKillMe && export test_3D_LOG_DIR='D:\app\extra_work_log\test-3d\%computername%' && start test-build.exe '-logfile -'"
exit 0

powershell 命令执行脚本

1
ssh -i /keystore/ssh -o 'StrictHostKeyChecking no' Administrator@-windows.xxx.com 'Powershell.exe -ExecutionPolicy Unrestricted -command "C:\\server\\windows-bat-code\\update-code.bat"'

update-code.bat

1
2
3
4
5
6
7
8
@echo "开始更新代码"
cd C:\server\monet-parent\
git clean -fdx
git checkout -- ./
git pull --rebase
@echo "开始安装python依赖包"
pip install -r C:\server\monet-parent\blender-3d\requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
exit 0

参考文档

Starting GUI programs via OpenSSH on Windows?

Starting application GUI on remote windows from SSH linux

bat脚本在特定目录中启动git bash窗口,并执行命令

------------- 本文结束 感谢您的阅读-------------