Module: DreamhostPersonalBackup::StatusManager
- Defined in:
- lib/backup/status_manager.rb
Constant Summary collapse
- PID_FILE =
'~/.dreamhost_personal_backup/running.pid'
Class Method Summary collapse
Class Method Details
.create_pid_file ⇒ Object
21 22 23 |
# File 'lib/backup/status_manager.rb', line 21 def self.create_pid_file File.open(File.(PID_FILE), "w") { |f| f.write(Process.pid) } end |
.is_backup_running? ⇒ Boolean
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/backup/status_manager.rb', line 7 def self.is_backup_running? pid_file = File.(PID_FILE) return false unless File.file?(pid_file) pid = File.open(pid_file).read.to_i begin Process.getpgid(pid) return true rescue Errno::ESRCH return false end end |
.remove_pid_file ⇒ Object
25 26 27 28 |
# File 'lib/backup/status_manager.rb', line 25 def self.remove_pid_file pid_file = File.(PID_FILE) File.delete(pid_file) if File.file?(pid_file) end |