restart.rb 570 B

1234567891011121314151617181920212223
  1. # Copyright (C) 2012-2025 Zammad Foundation, https://zammad-foundation.org/
  2. module Zammad
  3. module Restart
  4. def self.perform
  5. if ENV['APP_RESTART_CMD']
  6. if Rails.env.development?
  7. AppVersion.set(true, 'restart_auto')
  8. AppVersionRestartJob.perform_now(ENV['APP_RESTART_CMD'])
  9. return true
  10. end
  11. AppVersion.set(true, 'restart_auto')
  12. sleep 4
  13. AppVersionRestartJob.perform_later(ENV['APP_RESTART_CMD'])
  14. else
  15. AppVersion.set(true, 'restart_manual')
  16. end
  17. true
  18. end
  19. end
  20. end