Mail Archives: cygwin/2009/08/29/14:42:58
--------------000200050406020707080709
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
--------------000200050406020707080709
Content-Type: message/rfc822;
name="Re: Automating a Cygwin Script From Windows.eml"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="Re: Automating a Cygwin Script From Windows.eml"
X-Mozilla-Keys:
Message-ID: <4A99761B DOT 10003 AT columbus DOT rr DOT com>
Date: Sat, 29 Aug 2009 14:40:27 -0400
From: Paul McFerrin <pmcferrin AT columbus DOT rr DOT com>
Reply-To: pmcferrin AT columbus DOT rr DOT com
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
To: jprice <ddjones AT gmail DOT com>
Subject: Re: Automating a Cygwin Script From Windows
References: <25196125 DOT post AT talk DOT nabble DOT com> <BLU113-W14ACAF64A8F7E925F8982CBEF50 AT phx DOT gbl> <25196534 DOT post AT talk DOT nabble DOT com>
In-Reply-To: <25196534 DOT post AT talk DOT nabble DOT com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
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="/dev/null"
set PATH=C:\cygwin\bin;%PATH%
SET IS_CYGWIN=true
set HISTSIZE=1200
set HOME="/dev/null"
set CYGWIN=tty
ksh -c "C:/cygwin/backup_e
The above "backup_e" 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>/tmp/_backup_tracelog 1>&2
echo -e "Started - `date`"
set -x
cd /e
/c/WINDOWS/system32/cmd /c "dir /s/b/a:a *" >/tmp/_backupe_1
if [ -s /tmp/_backupe_1 ]
....
....
Using this scheme does NOT require you to setup/configure cygwin's
"cron". You can use Window's "Scheduled Tasks" feature under "Control
Panel".
- Paul
jprice wrote:
> Mike Marchywka-2 wrote:
>
>> ----------------------------------------
>>
>>> Date: Fri, 28 Aug 2009 13:04:44 -0700
>>> From: ddjones AT gmail DOT com
>>> To: cygwin AT cygwin DOT com
>>> Subject: Automating a Cygwin Script From Windows
>>>
>>>
>>> I need to run a cygwin script directly via windows, probably via dos
>>> prompt
>>> or some other comparable method. This method needs to be automated and
>>> kicked off in Windows at certain times, so executing Cygwin, then
>>> manually
>>> typing in the script to run in the Cygwin prompt is out of the question.
>>>
>>> I was hoping there would be some way to execute Cygwin and concurrently
>>> feed
>>> it a string of commands to execute upon opening, but unfortunately I have
>>> not had success with this. There seems to be lots of command line options
>>> for setting display options but nothing that would allow me to feed in a
>>> command.
>>>
>>> Is there any method to do this? Thanks for your time.
>>>
>>>
>> If you have an icon on your desktop, type the target it should
>> be something like cygwin.bat. You should IIRC just be able
>> to invoke bash with whatever params you need.
>>
>> I just tried it from dos prompt seems to work.
>>
>>
>>
>
> Can I invoke bash with scripts I want it to run as parameters? For instance,
> if I'd like a bat file that would execute bash, and then proceed to
> automatically run a cygwin script at at c:\foo, I'd want something like
> this:
>
> @echo off
> C:
> chdir C:\cygwin\bin
> bash --login -i -execute c:\foo
>
> Bash obviously doesn't contain an "-execute" option, but is there some
> method to achieve this?
>
>
--------------000200050406020707080709
Content-Type: text/plain; charset=us-ascii
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
--------------000200050406020707080709--
- Raw text -