www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/08/28/17:21:30

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.8 required=5.0 tests=AWL,BAYES_00,DATE_IN_FUTURE_06_12
X-Spam-Check-By: sourceware.org
From: "David Christensen" <dpchrist AT holgerdanske DOT com>
To: <cygwin AT cygwin DOT com>
Cc: "'jprice'" <ddjones AT gmail DOT com>
References: <25196125 DOT post AT talk DOT nabble DOT com>
Subject: RE: Automating a Cygwin Script From Windows
Date: Fri, 28 Aug 2009 21:21:17 -0700
Message-ID: <982E1586EC0C498DA2B6D69D843DB028@dc86yxb1>
MIME-Version: 1.0
In-Reply-To: <25196125.post@talk.nabble.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

jprice wrote:
> I need to run a cygwin script directly via windows, probably via dos
> prompt or some other comparable method.
> I was hoping there would be some way to ... feed it a string of
> commands to execute upon opening

I wrote a Bash/ Perl backup/ archive/ shutdown solution for my Windows/
Cygwin and GNU/ Linux SOHO network.  I light it off from my primary
Windows desktop via a Windows shortcut that points to a Windows batch
file that runs a Bash script that runs Perl scripts which do the work.
The batch file runs on Windows and will pass along up to nine command
line arguments.  The Bash script runs on Cygwin and GNU/Linux and passes
along an unlimited number of command-line arguments.  Here are the
Windows batch file and Bash script:

    2009-08-28 21:11:01 dpchrist AT dc86yxb1 ~/Dpchrist-Shutdown/example
    $ cat shutdown-soho.bat
    C:\cygwin\bin\bash U:\Dpchrist-Shutdown\example\shutdown-soho %1 %2
%3 %4 %5 %6 %7 %8 %9

    2009-08-28 21:15:48 dpchrist AT dc86yxb1 ~/Dpchrist-Shutdown/example
    $ cat shutdown-soho | egrep '^(#\!|/)'
    #! /usr/bin/bash
    /usr/bin/dcshutdown --use_at --use_sudo $* dpchrist AT p3450
dpchrist AT p3600
    /usr/bin/dcshutdown $* Administrator AT a64x23800p Administrator AT p31000
Administrator AT p3800 Administrator AT dc86yxb1
    /usr/bin/dcshutdown --shutdown_delay=0 --ssh_opts='-p 222' $*
root AT ipcop
    /usr/bin/dcshutdown $* localhost


HTH,

David


--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019