Automating a Cygwin Script From Windows

David Christensen dpchrist@holgerdanske.com
Fri Aug 28 21:21:00 GMT 2009


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@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@dc86yxb1 ~/Dpchrist-Shutdown/example
 $ cat shutdown-soho | egrep '^(#\!|/)'
 #! /usr/bin/bash
 /usr/bin/dcshutdown --use_at --use_sudo $* dpchrist@p3450
dpchrist@p3600
 /usr/bin/dcshutdown $* Administrator@a64x23800p Administrator@p31000
Administrator@p3800 Administrator@dc86yxb1
 /usr/bin/dcshutdown --shutdown_delay=0 --ssh_opts='-p 222' $*
root@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


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /