lib/tomo/plugin/sidekiq/tasks.rb in tomo-plugin-sidekiq-0.1.0 vs lib/tomo/plugin/sidekiq/tasks.rb in tomo-plugin-sidekiq-0.2.0
- old
+ new
@@ -35,11 +35,13 @@
paths.sidekiq_systemd_service
)
end
def linger_must_be_enabled!
- loginctl_result = remote.run "loginctl", "user-status", remote.host.user
- return unless loginctl_result.stdout.match?(/^\s*Linger:\s*no\s*$/i)
+ linger_users = remote.list_files(
+ "/var/lib/systemd/linger", raise_on_error: false
+ )
+ return if dry_run? || linger_users.include?(remote.host.user)
die <<~ERROR.strip
Linger must be enabled for the #{remote.host.user} user in order for
sidekiq to stay running in the background via systemd. Run the following
command as root: