Class: RedisBackup
- Inherits:
-
QuartzPlugin
- Object
- QuartzPlugin
- RedisBackup
- Defined in:
- lib/plugins/redis_backup.rb
Constant Summary collapse
- @@version_major =
0
- @@version_minor =
0
- @@version_revision =
1
Instance Method Summary collapse
Methods inherited from QuartzPlugin
#get_version, #initialize, #payload, #run_result, #run_shell
Constructor Details
This class inherits a constructor from QuartzPlugin
Instance Method Details
#info ⇒ Object
10 11 12 |
# File 'lib/plugins/redis_backup.rb', line 10 def info { :uid => "6342c1ef0d8bb2a47ab1362a6b02c058", :name => "Redis Backup", :version => get_version } end |
#run(message) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/plugins/redis_backup.rb', line 14 def run() pl = payload() @job_name = pl['job_name'].gsub(/[^\w\s_-]+/, '').gsub(/(^|\b\s)\s+($|\s?\b)/, '\\1\\2').gsub(/\s/, '_') @redisdump_utility = pl['redis_client'] || '/usr/bin/redis-cli' @name = pl['db_name'] || 'dump' @password = pl['password'] @socket = pl['socket'] @host = pl['host'] || '127.0.0.1' @port = pl['port'] || 6379 @additional_options = pl['additional_options'] || [] @path = pl['db_path'] @dump_path = pl['backup_folder'] @name = 'dump' if @name.empty? @host = '127.0.0.1' if @host.empty? @port = 6379 if @port.empty? @additional_options = [] if @additional_options.empty? @redisdump_utility = '/usr/bin/redis-cli' if @redisdump_utility.empty? save_result = invoke_save return save_result unless save_result.nil? result = copy if result[:ok] run_result(true, "Redis Backup finished successfully") else run_result(false, result[:message]) end end |