7

I currently have this under my shortcut

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

after that is run i have to type in

cd x:ENTER

then i run a curl script which does not change.

I tried to automate it by running the following command but it does not seem to work

my SH file

#!/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;'

this is what i run in CMD

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

cygwin popup for 2 seconds and disappear.

please help

update

New error

$ /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
rojo
  • 24,000
  • 5
  • 55
  • 101
nkman
  • 545
  • 2
  • 5
  • 13

3 Answers3

6

for whoever is interested in this .. here is the solution

create a shortcut in windows for Mintty with the following taret

Assuming your shell file is located in c:\cygwin\bin

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

once you have the shortcut working, you can do a windows task scheduler and take it from there.

Windows 7 Pro: Create a basic task with Windows Task Scheduler to start DAILY and go through all the steps. Once you have created the task, go to Properties and then go to TRIGGERS tab and click EDIT

under ADVANCED SETTINGS frame, you'll se REPEAT TASK EVERY.... self-explanatory from there.

nkman
  • 545
  • 2
  • 5
  • 13
3

Your command is telling mintty to start up and run your script, which is what it proceeds to do, then exit. That "popup" as you call it, is the terminal opening, running the command you passed it, and then exiting since it has done its job.

Costa
  • 2,043
  • 1
  • 14
  • 27
3

Does mintty.exe evaluate arguments to --exec with a filesystem root of c:\ or the cygwin environment /? Try this.

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

or

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

Also, if you haven't done so, you should chmod 755 /bin/test.sh to make it executable.

rojo
  • 24,000
  • 5
  • 55
  • 101
  • tried both and still nothing :( I should get an email as a result if the server received the JSON file, with error or not. – nkman Apr 11 '13 at 15:33
  • @nkman - Is is `c:\cygwin\bin` the actual location of `test.sh`? Does the script have the desired effect if you launch `mintty.exe` and within that console, execute `/bin/test.sh`? If not, is there a relevant error produced? – rojo Apr 11 '13 at 16:42
  • yes the actual location for test.sh is c:\cygwin\bin . I launched Mintty and "exec /bin/test.sh". NO error but the window closes itself after. – nkman Apr 11 '13 at 16:48
  • That's weird that the window would close itself if you were at a bash prompt. Does it help to modify your `.sh` script and change `cd x:` to `cd /cygdrive/x` ? If that doesn't help, try adding a `sleep 5s` and an `echo` of some sort after each command to see at what point your console is crashing. – rojo Apr 11 '13 at 16:52
  • my message is too long. PLease look at the updated on my question. – nkman Apr 11 '13 at 17:00
  • Same error when launching `/bin/test.sh`? By the way, you don't really need `exec`. Just type `/bin/test.sh` at the `$` prompt. – rojo Apr 11 '13 at 17:05
  • correct. The CURL works fine outside the script. $ curl **URL** --connect-timeout 10000 --max-time 10000 --data-binary @test.json -H 'Content-type:application/json;charset=utf-8;X-Vendor-Email=myemail@mail.com;' {"uploaded":true,"message":" JSON received. A email will be sent after processing has completed."} – nkman Apr 11 '13 at 18:37
  • Sorry nkman, but I coudln't tell you why your `curl` command succeeds from the bash prompt but not within a shell script. But in any case, the current problem under discussion no longer has anything to do with the title at the top of this page. You probably ought to edit your question and make **that** the question though. Why does curl succeed from the command line but fail in this script? And maybe change the "Windows" tag to "bash" or similar. – rojo Apr 11 '13 at 18:49
  • Thanks for the help rojo. One problem leads to another :) – nkman Apr 11 '13 at 19:08