How to run shell commands on server in Capistrano v3?

前端 未结 1 1406
心在旅途
心在旅途 2020-12-23 01:56

I\'m new to Capistrano and I\'ve tried using Capistrano\'s DSL to run shell commands on the server (\'run\', \'execute\', etc.), but it appears that it was deprecated. After

相关标签:
1条回答
  • 2020-12-23 02:37

    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/

    0 讨论(0)
提交回复
热议问题