Simplify serverStart with server name to start
Dieser Commit ist enthalten in:
Ursprung
534673cdc5
Commit
0ed8d26a66
22
build.gradle
22
build.gradle
@ -98,11 +98,13 @@ if (project.hasProperty("hostname")) {
|
|||||||
group "Steamwar"
|
group "Steamwar"
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
await(shell("scp ${libs}/${jarName} ${hostname}:~/Dev1.15/plugins"))
|
def server = "Dev1.15"
|
||||||
if (!answer("Start DEV server?")) {
|
// def server = "Developer"
|
||||||
|
await(shell("scp ${libs}/${jarName} ${hostname}:~/${server}/plugins"))
|
||||||
|
if (!answer("Start ${server} server?")) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
serverStart()
|
serverStart(server)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,12 +115,6 @@ def await(Process proc) {
|
|||||||
proc.waitForProcessOutput(out, err)
|
proc.waitForProcessOutput(out, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Executes a shell command and returns the stdout result.
|
|
||||||
*
|
|
||||||
* @param command the command to execute (cannot contain pipes)
|
|
||||||
* @return the trimmed result from stdout, stderr and the exit value
|
|
||||||
*/
|
|
||||||
def shell(String command) {
|
def shell(String command) {
|
||||||
def proc
|
def proc
|
||||||
if (operatingSystem == "unix") {
|
if (operatingSystem == "unix") {
|
||||||
@ -129,11 +125,11 @@ def shell(String command) {
|
|||||||
return proc
|
return proc
|
||||||
}
|
}
|
||||||
|
|
||||||
def serverStart() {
|
def serverStart(String serverName) {
|
||||||
def proc = shell("ssh -t ${hostname} \"./mc Dev1.15\"")
|
def proc = shell("ssh -t ${hostname} \"./mc ${serverName}\"")
|
||||||
|
|
||||||
Thread outputThread = proc.consumeProcessOutputStream(System.out)
|
Thread outputThread = proc.consumeProcessOutputStream(System.out)
|
||||||
outputThread.setName("OutputThread")
|
outputThread.setName("${serverName} - OutputThread")
|
||||||
|
|
||||||
Thread inputThread = new Thread(new Runnable() {
|
Thread inputThread = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -151,7 +147,7 @@ def serverStart() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
inputThread.setName("InputThread")
|
inputThread.setName("${serverName} - InputThread")
|
||||||
inputThread.start()
|
inputThread.start()
|
||||||
|
|
||||||
while (proc.alive) {
|
while (proc.alive) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren