Created
July 15, 2016 11:40
-
-
Save jagedn/ed08f182a3866680684fc01921941ba5 to your computer and use it in GitHub Desktop.
Use Gpars + Sshoogr to distribute a jar and execute it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('com.aestasit.infrastructure.sshoogr:sshoogr:0.9.25') | |
@Grab('org.codehaus.gpars:gpars:1.2.1') | |
@GrabConfig(systemClassLoader = true) | |
import static com.aestasit.infrastructure.ssh.DefaultSsh.* | |
import groovyx.gpars.GParsPool | |
options.trustUnknownHosts = true | |
stores = [ '10.0.1.1', '10.0.2.1', '10.0.3.1' ] | |
GParsPool.withPool(10) { | |
stores.eachParallel{ ip -> | |
remoteSession("user:pwd@${ip}") { | |
scp{ | |
from { localFile "./dist/forecast.jar" } | |
into { remoteFile 'forecast.jar' } | |
} | |
exec( showOutput: true, command: 'java -jar forecast.jar' ) | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment