Skip to content

Instantly share code, notes, and snippets.

@dev4dev dev4dev/redis
Created Feb 28, 2012

Embed
What would you like to do?
start/stop redis-server
#!/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
You can’t perform that action at this time.