Kostas
Kostas

Reputation: 8595

Run a command on remote hosts through capistrano from the command line

Is there way to run a command in capistrano without adding it to a Capfile?

example:

cap --eval "run 'du -sh'" --role web

Upvotes: 8

Views: 3649

Answers (2)

Kelvin
Kelvin

Reputation: 20867

You can use this to run a command on the servers.

cap ROLES=web invoke COMMAND='du -sh'

If you don't even have a cap recipe, you can specify the servers on the command-line:

cap -s user=myusername HOSTS=server1.com,server2.com invoke COMMAND='du -sh'

To see more command-line options, run cap -H and cap -e invoke.

Upvotes: 10

Simone Carletti
Simone Carletti

Reputation: 176412

You can use the (experimental) Capistrano shell.

$ cap shell

Upvotes: 5

Related Questions