groovenauts / capistrano-systemd-multiservice

Capistrano Plugin to control services with systemd
MIT License
45 stars 17 forks source link

systemctl stderr: Too few arguments. #13

Closed nleo closed 5 years ago

nleo commented 5 years ago

I install and enamble unit with Ansible to ~/.config/systemd/user/rpush.service

I try to cap staging systemd:rpush:restart, but got an error:

00:00 systemd:rpush:restart
      01 systemctl --user restart 
      01 Too few arguments.
#<Thread:0x0000555a45438a60@/var/lib/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
    1: from /var/lib/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/var/lib/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as skycontrol@api.staging.skycontrol.app: systemctl exit status: 1 (SSHKit::Runner::ExecuteError)
systemctl stdout: Nothing written
systemctl stderr: Too few arguments.
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as skycontrol@api.staging.skycontrol.app: systemctl exit status: 1
systemctl stdout: Nothing written
systemctl stderr: Too few arguments.

Caused by:
SSHKit::Command::Failed: systemctl exit status: 1
systemctl stdout: Nothing written
systemctl stderr: Too few arguments.

Tasks: TOP => systemd:rpush:restart
(See full trace by running task with --trace)

I think command should be systemctl --user restart rpush, but it don't.

nleo commented 5 years ago
require 'capistrano/systemd/multiservice'
install_plugin Capistrano::Systemd::MultiService.new_service('rpush', service_type: 'user')
minimum2scp commented 5 years ago

@nleo Do you have config/systemd/rpush.service.erb file?

If not, and if you don't want to put the file, please try to set systemd_rpush_service in config/deploy.rb or config/deploy/stage.rb like this:

set :systemd_rpush_service, ->{ "rpush.service" }
minimum2scp commented 5 years ago

ping @nleo

nleo commented 5 years ago

Hi, for now I use this code in my deploy.rb

namespace :rpush do
  desc 'restart rpush'
  task :restart do
    on roles(:app) do
      execute 'systemctl --user restart rpush'
    end
  end
end

Mayby later in new project I test your variant. Thanks for response