I want to write a script that connects to a 2nd host to execute commands there.
with dep deploy stage
it should executes task on host: live too
It connects to host: live
makes a db-dump
and downloads is to the deploy-computer
It connects to host: stage
uploads the db-dump
and integrates it there
The basic parts of mysql-dump end mysl-import I know, but how to execute a task on another host?
Thanks for pointing to the right direction!
Inside each task you can run the "on" function. For this you can supply a host (in your example during a "live" task you would supply "stage"):
on(host('stage'), function () {
// do something
});
If you need to supply some variables (e.g. dynamically created filenames) you can hand them to the new function like with use
. So if your task saved your dump to the filename $mysqlDumpFilename, e.g.:
on(host('stage'), function () use ($mysqlDumpFilename) {
// do something
});