This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Autostart Cygwin on Windows boot and run a cygwin command
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