Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added workaround for spaces in configuration filename. #1

Merged
merged 1 commit into from
Oct 30, 2011
Merged

Added workaround for spaces in configuration filename. #1

merged 1 commit into from
Oct 30, 2011

Conversation

thomasbratt
Copy link
Contributor

I have made a change to allow spaces in the configuration filename. It would be great if you could pull this into the main branch.

Many thanks for the making the service - it has saved me a lot of time.

Большое спасибо,

Thomas

kcherenkov added a commit that referenced this pull request Oct 30, 2011
Added workaround for spaces in configuration filename.
@kcherenkov kcherenkov merged commit b43c3d3 into kcherenkov:master Oct 30, 2011
@kcherenkov
Copy link
Owner

Thank you Thomas!

@philostler
Copy link

I can't get this to work with spaces in the path. If you use sc create as listed in the README...

sc create %name% binpath= "\"%binpath%\" %configpath%" start= "auto" DisplayName= "Redis"

My command becomes...

sc create Redis binpath= "\"C:\Users\Phil Ostler\Desktop\redis\bin\x86\redis-service.exe\" C:\Users\Phil Ostler\Desktop\redis\bin\redis.conf" start= "auto" DisplayName= "Redis"

...which fails to start with a message that the service "started and then stopped". If I wrap the config in quotes...

sc create Redis binpath= "\"C:\Users\Phil Ostler\Desktop\redis\bin\x86\redis-service.exe\" \"C:\Users\Phil Ostler\Desktop\redis\bin\redis.conf\"" start= "auto" DisplayName= "Redis"

...then the service will start but there is no response when attempting a ping.

If I offer up a config path without any spaces...

sc create Redis binpath= "\"C:\Users\Phil Ostler\Desktop\redis\bin\x86\redis-service.exe\" \"C:\Redis\bin\redis.conf\"" start= "auto" DisplayName= "Redis"

...I get a successful start and ping back. And still successful with quotes removed...

sc create Redis binpath= "\"C:\Users\Phil Ostler\Desktop\redis\bin\x86\redis-service.exe\" C:\Redis\bin\redis.conf" start= "auto" DisplayName= "Redis"

From the command line, this works...

redis-server.exe "C:\Users\Phil Ostler\Desktop\redis\bin\redis.conf"

..this does not...

redis-service.exe "C:\Users\Phil Ostler\Desktop\redis\bin\redis.conf"

and generates the following output.

Usage: ./redis-server [/path/to/redis.conf]
       ./redis-server - (read config from stdin)

Once again, removing the spaces fixes the error.

redis-service.exe "C:\Redis\bin\redis.conf"

It doesn't appear to be able to handle a config file with spaces in the path. I'm running Windows 7 Pro.

@thomasbratt
Copy link
Contributor Author

Hi Phil,

The fix was done in a hurry for a project at work. I hoped I could help others avoid the pain I went through to get the service to run. It is possible that I got it wrong and it doesn't work for anything apart from the case I had to get working.

Did you try building from the head revision or did you download the .EXE? It could be that the .EXE hasn't been rebuilt.

Thomas

@thomasbratt
Copy link
Contributor Author

Hmm. According to the download page, the .EXE was rebuilt: December 02, 2011.

@kcherenkov
Copy link
Owner

Hi, guys.

Please re-download binary file, it should work now with spaces.
I think that problem was in internet browser cache (browser give you old version instead of new one).

Please check it now and let me know.
https://github.com/kcherenkov/redis-windows-service/downloads

@philostler
Copy link

Thanks both, the following command now starts successfully and pings back.

sc create Redis binpath= "\"C:\Users\Phil Ostler\Desktop\redis\bin\x86\redis-service.exe\" \"C:\Users\Phil Ostler\Desktop\redis\bin\redis.conf\"" start= "auto" DisplayName= "Redis"

Thank you both! Now this is all working, my Redis startup is super slick. Great work!

@thomasbratt
Copy link
Contributor Author

Glad to hear it's all working :)

@philostler
Copy link

This might be helpful to others who find this thread. I've written a gist of three batch files to automate creation of and removal of a Redis Windows Service. Remember to change the paths to match your setup. https://gist.github.com/1455330

@thomasbratt
Copy link
Contributor Author

Nice. Is it worth doing a push request with these?

@philostler
Copy link

I could include them in a push, put them under a Scripts directory. I've only tested them on Windows 7 x86.

Will be creating a new public repo tomorrow as an example of how one might layout a windows Redis directory with the scripts incorporated as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants