This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Autostart Cygwin on Windows boot and run a cygwin command




Jeremy Bopp-3 wrote:
> 
> On 3/14/2011 13:25, PeterSmith wrote:
> 
> FYI, this list prefers bottom posting rather than top posting.
> Reformatting... :-)
> 
>> Jeremy Bopp-3 wrote:
>>> 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. :-)
>>
>> 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.
> 
> What Startup Folder are you talking about exactly?  I'm probably just
> not aware of such a folder whose contents are executed by the system
> upon boot up, but if you're talking about the folder for your user
> account, that will only be run when you log in.  If your machine
> automatically logs you in on boot up, you'll be fine in that case;
> otherwise, you'll need to hook this up a bit differently.
> 
> You may want to look into the Registry:
> 
> HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
> 
> I'm not sure if you can directly run a batch file there or if you'll
> have to run cmd with the batch file as an argument.  Assuming this works
> for you, the only problem then will likely be that this will run as the
> Local System account rather than your user, which may or may not matter
> to you.
> 
>> 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
> 
> I forgot to include the final quote in my first reply.  Try again with a
> quote at the end of that last line.
> 
> -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
> 
> 
> 

Ok, so for now lets focus on the contents of the .bat file. I'll have a look
at the startup of the bat later :)

I now have this:
@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 still gives me the exact same 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 dir
ectory
Unable to access jarfile start.jar
C:\cygwin\bin>


However, when I have this in my .bat file:
@echo off
C:
chdir C:\cygwin\bin
bash --login -i
rem 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" 

I DO get the Cygwin command prompt. What am I missing here?


-- 
View this message in context: http://old.nabble.com/Autostart-Cygwin-on-Windows-boot-and-run-a-cygwin-command-tp31144428p31147631.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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]