The mina have special syntax for this. From mina console help page:
Server tasks:
...
mina rails[arguments] # Execute a Rails command in the current deploy
mina rake[arguments] # Execute a Rake command in the current deploy
mina run[command] # Runs a command in the server
...
So from command line:
$ mina 'rake[deploy:backup_db]'
Or define task in mina deploy config file (config/deploy.rb
):
task :backup_db do
invoke :'rake[deploy:backup_db]'
end