1
我嘗試部署使用搖籃SSH插件搖籃SSH插件與nohup的
remotes {
ftc {
role 'masterNode'
host = '173.199.123.42'
user = 'root'
password = 'myPass'
}
}
ssh.settings {
knownHosts = allowAnyHosts
}
task deploy {
doLast {
ssh.run {
session(remotes.ftc) {
execute 'pkill -f \'java.*chat\'', ignoreError: true
remove 'build/libs/chat.jar'
put from: file('build/libs/chat.jar'), into: '/root/test'
execute 'nohup java -jar /root/test/chat.jar &'
}
}
}
}
它的工作原理,除了它永遠不會結束,它會卡在execute nohup java -jar /root/test/chat.jar &
我怎樣才能使我的Java構建至CentOS在後臺運行?
也許你可以使用該'screen'? – Antoniossss