delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/03/14/14:25:48

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=BAYES_00,FORGED_HOTMAIL_RCVD2,FREEMAIL_FROM,T_RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
Message-ID: <31147099.post@talk.nabble.com>
Date: Mon, 14 Mar 2011 11:25:30 -0700 (PDT)
From: PeterSmith <petervdkerk AT hotmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Autostart Cygwin on Windows boot and run a cygwin command
In-Reply-To: <4D7E5A1D.5030702@bopp.net>
MIME-Version: 1.0
References: <31144428 DOT post AT talk DOT nabble DOT com> <4D7E5A1D DOT 5030702 AT bopp DOT net>
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

First of: sorry for not providing all info.

I DO want to run this command as soon as my machine boots. My server
sometimes reboots at night after an update. So when Windows starts, in the
Startup Folder I will place a shortcut to the .bat file.

I the bat file I now have:
@echo off
C:
chdir C:\cygwin\bin

bash -c "cd
/cygdrive/e/solr/apache-solr-4.0-2010-10-12_08-05-48/example/;java
-Dsolr.solr.home=\"./example-DIH/solr/\" -jar start.jar 

When I run this from the command prompt I get this error:

C:\>start_cygwin.bat
bash: line 0: cd:
/cygdrive/e/solr/apache-solr-4.0-2010-10-12_08-05-48/example/: No such file
or directory
Unable to access jarfile start.jar
C:\cygwin\bin>


Hopefully my problem is more clear now and you can further assist me :)





Jeremy Bopp-3 wrote:
> 
> On 3/14/2011 09:07, PeterSmith wrote:
>> 
>> Sometimes my Windows server reboots at night to install new updates. Then
>> the
>> next day I find out that my cygwin instance has been stopped.
>> 
>> What I want is on Windows start, also run Cygwin AND run a specific
>> command.
>> 
>> so, step 1: Right now I have a cygwin.bat to start cygwin:
>> 
>> @echo off
>> C:
>> chdir C:\cygwin\bin
>> bash --login -i
>> 
>> step 2 is to enter the command in the command windows that appears after
>> running cygwin.bat:
>> 
>> cd /cygdrive/e/solr/apache-solr-4.0-2010-10-12_08-05-48/example/;java
>> -Dsolr.solr.home="./example-DIH/solr/" -jar start.jar
>> 
>> But this command is what I want to have called automatically when i run
>> cygwin.bat
>> 
>> How can I combine step 1 and step 2 into a single bat file which I can
>> run
>> on Windows start?
> 
> While not 100% clear, I'm going to assume from your description that you
> actually want this to run when you log in rather than when the machine
> boots up.  It also looks like you know how to handle that part yourself.
>  Ask about setting up a service if you would like this to run
> independently of whether or not you ever log into the machine though.
> 
>> I tried this code:
>> @echo off
>> C:
>> chdir C:\cygwin\bin
>> bash -c cd
>> /cygdrive/e/solr/apache-solr-4.0-2010-10-12_08-05-48/example/;java
>> -Dsolr.solr.home="./example-DIH/solr/" -jar start.jar
>> 
>> But that doesnt work...
> 
> You need to help us help you here.  Simply saying that something doesn't
> work without including any further details about what you see or error
> messages you receive forces us to guess about the problem.
> 
> My guess about your problem is that your bash command is flawed.  The -c
> option takes a single string that will be run as a command, and since
> your command has spaces in it, you need to quote it.  Otherwise, the
> command will be split on those spaces which will lead to erroneous
> arguments for bash.  Because your command also has quotes, you'll need
> to escape those with backslashes if you absolutely must keep them.
> Maybe something like this will work for you:
> 
> bash -c "cd
> /cygdrive/e/solr/apache-solr-4.0-2010-10-12_08-05-48/example/;java
> -Dsolr.solr.home=\"./example-DIH/solr/\" -jar start.jar
> 
> If you still have problems, please provide more details. :-)
> 
> -Jeremy
> 
> --
> 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
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Autostart-Cygwin-on-Windows-boot-and-run-a-cygwin-command-tp31144428p31147099.html
Sent from the Cygwin list mailing list archive at Nabble.com.


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