[From nobody Wed Mar 25 13:52:19 2020
X-Mozilla-Keys: 
Message-ID: &lt;4A99761B.10003@columbus.rr.com&gt;
Date: Sat, 29 Aug 2009 14:40:27 -0400
From: Paul McFerrin &lt;pmcferrin@columbus.rr.com&gt;
Reply-To: pmcferrin@columbus.rr.com
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
To: jprice &lt;ddjones@gmail.com&gt;
Subject: Re: Automating a Cygwin Script From Windows
References: &lt;25196125.post@talk.nabble.com&gt;
 &lt;BLU113-W14ACAF64A8F7E925F8982CBEF50@phx.gbl&gt; &lt;25196534.post@talk.nabble.com&gt;
In-Reply-To: &lt;25196534.post@talk.nabble.com&gt;
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-length: 3034

Well there is more than one way to kill this cat.  Let me add my cocktail.

I have a need to automatically run scripts, totally written in cygwin 
using ksh as my shell.  For example I have a number of .bat files 
performing necessary startup functions:
        echo off
        set ENV=&quot;/dev/null&quot;
        set PATH=C:\cygwin\bin;%PATH%
        SET IS_CYGWIN=true
        set HISTSIZE=1200
        set HOME=&quot;/dev/null&quot;
        set CYGWIN=tty
        ksh -c &quot;C:/cygwin/backup_e

The above &quot;backup_e&quot; is the work horse.  It can be anything from a 
complicated script or starting up anything to running under cygwin.

In this case I'm not providing any parameters that can be added if you 
so desire.  Basically backup_e is an ordinary cygwin script:
        #!/bin/ksh
        #
        #       backup_e
        #
        #       Perform a incremental backup of drive e: of all
        #       files having the archive attribute set.
        #
        #       get list of files ready to archive
        exec 2&gt;/tmp/_backup_tracelog 1&gt;&amp;2
        echo -e &quot;Started - `date`&quot;
        set -x
        cd /e
        /c/WINDOWS/system32/cmd /c &quot;dir /s/b/a:a *&quot; &gt;/tmp/_backupe_1
        if [ -s /tmp/_backupe_1 ]
        ....
        ....

Using this scheme does NOT require you to setup/configure cygwin's 
&quot;cron&quot;.  You can use Window's &quot;Scheduled Tasks&quot; feature under &quot;Control 
Panel&quot;.

- Paul


jprice wrote:
&gt; Mike Marchywka-2 wrote:
&gt;   
&gt;&gt; ----------------------------------------
&gt;&gt;     
&gt;&gt;&gt; Date: Fri, 28 Aug 2009 13:04:44 -0700
&gt;&gt;&gt; From: ddjones@gmail.com
&gt;&gt;&gt; To: cygwin@cygwin.com
&gt;&gt;&gt; Subject: Automating a Cygwin Script From Windows
&gt;&gt;&gt;
&gt;&gt;&gt;
&gt;&gt;&gt; I need to run a cygwin script directly via windows, probably via dos
&gt;&gt;&gt; prompt
&gt;&gt;&gt; or some other comparable method. This method needs to be automated and
&gt;&gt;&gt; kicked off in Windows at certain times, so executing Cygwin, then
&gt;&gt;&gt; manually
&gt;&gt;&gt; typing in the script to run in the Cygwin prompt is out of the question.
&gt;&gt;&gt;
&gt;&gt;&gt; I was hoping there would be some way to execute Cygwin and concurrently
&gt;&gt;&gt; feed
&gt;&gt;&gt; it a string of commands to execute upon opening, but unfortunately I have
&gt;&gt;&gt; not had success with this. There seems to be lots of command line options
&gt;&gt;&gt; for setting display options but nothing that would allow me to feed in a
&gt;&gt;&gt; command.
&gt;&gt;&gt;
&gt;&gt;&gt; Is there any method to do this? Thanks for your time.
&gt;&gt;&gt;
&gt;&gt;&gt;       
&gt;&gt; If you have an icon on your desktop, type the target it should
&gt;&gt; be something like cygwin.bat. You should IIRC just be able
&gt;&gt; to invoke bash with whatever params you need.
&gt;&gt;
&gt;&gt; I just tried it from dos prompt seems to work.
&gt;&gt;
&gt;&gt;
&gt;&gt;     
&gt;
&gt; Can I invoke bash with scripts I want it to run as parameters? For instance,
&gt; if I'd like a bat file that would execute bash, and then proceed to
&gt; automatically run a cygwin script at at c:\foo, I'd want something like
&gt; this:
&gt;
&gt; @echo off
&gt; C:
&gt; chdir C:\cygwin\bin
&gt; bash --login -i -execute c:\foo
&gt;
&gt; Bash obviously doesn't contain an &quot;-execute&quot; option, but is there some
&gt; method to achieve this?
&gt;
&gt;   


]