How to run shell commands on server in Capistrano v3?

In Capistrano v3, you must specify where you want to run the code by calling on with a list of hostnames, e.g.

task :execute_on_server do
  on "root@example.com" do
    execute "some_command"
  end
end

If you have roles set up, you can use the roles method as a convenience:

role :mailserver, "root@mail.example.com"

task :check_mail do
  on roles(:mailserver) do
    execute "some_command"
  end
end

There is some v3 documentation here: http://www.capistranorb.com/

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)