Class: CertbotJob
- Inherits:
-
Object
- Object
- CertbotJob
- Includes:
- Sidekiq::Job
- Defined in:
- app/jobs/wco_hosting/certbot_job.rb
Instance Method Summary collapse
Instance Method Details
#perform(id) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/jobs/wco_hosting/certbot_job.rb', line 9 def perform id puts! id, 'CertbotJob#perform...' app = WcoHosting::Appliance.find id cmd = "ssh #{app.serverhost.ssh_host} 'certbot run -d #{app.host} --nginx -n ' " stdout, stderr, status = Open3.capture3(cmd) status = status.to_s.split.last.to_i if 0 != status && 0 != app.n_retries app.update_attributes({ n_retries: app.n_retries - 1 }) CertbotJob.perform_in( 15.minutes, app.id.to_s ) end end |