def run_after_response(seconds, *command)
      logger.debug "Power API scheduling in #{seconds} seconds: #{command.inspect}"
      Thread.start do
        begin
          sleep seconds
          logger.debug "Power API executing: #{command.inspect}"
          if (sudo = which('sudo'))
            status = system(sudo, *command)
          else
            logger.warn "sudo binary was not found"
          end
          # only report errors
          logger.warn "The attempted command failed with code #{$?.exitstatus}" unless status
        rescue Exception => e
          logger.error "Error during command execution: #{e}"
        end
      end
    end
def run_after_response(seconds, *command)
      logger.debug "Power API scheduling in #{seconds} seconds: #{command.inspect}"
      Thread.start do
        begin
          sleep seconds
          logger.debug "Power API executing: #{command.inspect}"
          if (sudo = which('sudo'))
            status = system(sudo, *command)
          else
            logger.warn "sudo binary was not found"
          end
          # only report errors
          logger.warn "The attempted command failed with code #{$?.exitstatus}" unless status
        rescue Exception => e
          logger.error "Error during command execution: #{e}"
        end
      end
    end
Execute command in a separate thread after 5 seconds to give the server some
 time to finish the request. Does *not* execute via a shell.