Dom
Dom

Reputation: 3126

Executing WP-CLI via SSH and Capistrano

I am fairly new to cap hence I can't figure out one thing.

I have wp-cli installed on my server which I can run with wp ie wp --vetsion directly on the server will output WP-CLI 0.19.1 - great.

What I am trying to achieve is run the command with Capistrano

namespace :test do
    desc "Show WP-CLI version"
    task :dosomething do
          run "cd #{release_path} && wp --version"
    end
end

Unfortunately it is returning the following error :

sh: wp: command not found

Im not sure where I am going wrong.

Any help much appreciated.

Thank you in advance

Upvotes: 0

Views: 248

Answers (1)

Rolle
Rolle

Reputation: 151

SSH into your server and run which wp or find /home/yourusername/ -name 'wp' to find out where wp-cli is located.

Let's say wp-cli is located under your home path in bin folder, then you would add run "cd #{release_path} && /home/yourusername/bin/wp --version". I hope this helps.

Upvotes: 1

Related Questions