7

我目前在我的快捷方式下有这个

C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico -

在那之后我必须输入

cd x:ENTER

然后我运行一个curl不会改变的脚本。

我试图通过运行以下命令来自动化它,但它似乎不起作用

我的 SH 文件

#!/bin/bash

cd x:
curl http://thedomain.com/update.json --connect-timeout 10000 --max-time 10000 --data-binary @jsonfilename -H 'Content-type:application/json;charset=utf-8;X-Vendor-Email=myemail@.com;'

这就是我在 CMD 中运行的

mintty.exe --exec 'c:/cygwin/bin/test.sh'

cygwin 弹出 2 秒然后消失。

请帮忙

更新

新错误

$ /bin/test.sh
      0 [main] bash 12000 child_info_fork::abort: cygreadline7.dll: Loaded to different address: parent(0x3B0000) != child(0x320000)
/bin/test.sh: fork: retry: Resource temporarily unavailable
      0 [main] bash 12052 child_info_fork::abort: cygreadline7.dll: Loaded to different address: parent(0x3B0000) != child(0x2B0000)
/bin/test.sh: fork: retry: Resource temporarily unavailable
      0 [main] bash 9304 child_info_fork::abort: cygreadline7.dll: Loaded to different address: parent(0x3B0000) != child(0x3A0000)
/bin/test.sh: fork: retry: Resource temporarily unavailable
      0 [main] bash 9036 child_info_fork::abort: cygreadline7.dll: Loaded to different address: parent(0x3B0000) != child(0x3A0000)
/bin/test.sh: fork: retry: Resource temporarily unavailable
      0 [main] bash 9588 child_info_fork::abort: cygreadline7.dll: Loaded to different address: parent(0x3B0000) != child(0x3C0000)
/bin/test.sh: fork: Resource temporarily unavailable
4

3 回答 3

6

对于对此感兴趣的人..这是解决方案

使用以下 taret 在 Windows 中为 Mintty 创建一个快捷方式

假设您的 shell 文件位于 c:\cygwin\bin

C:\cygwin\bin\mintty.exe /bin/bash -l -e '/cygdrive/c/cygwin/bin/test.sh'

一旦你的快捷方式工作,你可以做一个 Windows 任务计划程序并从那里获取它。

Windows 7 Pro:使用 Windows 任务计划程序创建一个基本任务以每天启动并完成所有步骤。创建任务后,转到“属性”,然后转到“触发器”选项卡并单击“编辑”

在高级设置框架下,您将看到 REPEAT TASK EVERY.... 从那里不言自明。

于 2013-04-12T20:42:12.960 回答
3

您的命令告诉mintty您启动并运行您的脚本,这就是它继续执行的操作,然后退出。你所说的那个“弹出窗口”是终端打开,运行你传递给它的命令,然后退出,因为它已经完成了它的工作。

于 2013-04-10T19:48:26.877 回答
3

是否使用文件系统根目录或 cygwin 环境mintty.exe评估参数?试试这个。--execc:\/

mintty.exe --exec '/bin/test.sh'

或者

mintty.exe --exec '/cygdrive/c/cygwin/bin/test.sh'

此外,如果您还没有这样做,您应该chmod 755 /bin/test.sh使其可执行。

于 2013-04-10T19:51:54.527 回答