Created
February 28, 2012 18:21
-
-
Save dev4dev/1934126 to your computer and use it in GitHub Desktop.
start/stop redis-server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -wKU | |
redis_bin = %x[which redis-server].strip | |
redis_cli = %x[which redis-cli].strip | |
redis_pid = '/usr/local/var/run/redis.pid' | |
redis_cfg = '/usr/local/etc/redis.conf' | |
if File.exists? redis_pid | |
## stop redis | |
print 'stopping redis-server...' | |
%x[#{redis_cli} -p 6379 SHUTDOWN] | |
print 'done' | |
else | |
## start redis | |
print 'starting redis-server...' | |
%x[#{redis_bin} #{redis_cfg}] | |
print 'done' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment