Hello,
The ‘:terminateOfbiz’ Gradle task is meant to be run when ‘./gradlew
ofbiz --shutdown’ doesn't work. Unfortunately this task is not working
on my GNU/linux system because the output of ‘ps ax’ cuts long lines.
As a consequence Gradle is not able to grep
"org.apache.ofbiz.base.start.Start" even if it is actually part of the
process command line as seen by the operating system. As a reminder,
here is the implementation of that task:
task terminateOfbiz(group: ofbizServer,
description: 'Force termination of any running OFBiz servers, only use
if \"--shutdown\" command fails') {
doLast {
if (os.contains('windows')) {
Runtime.getRuntime().exec("wmic process where \"CommandLine
Like \'%org.apache.ofbiz.base.start.Start%\'\" Call Terminate")
} else {
def processOutput = new ByteArrayOutputStream()
exec {
commandLine 'ps', 'ax'
standardOutput = processOutput
}
processOutput.toString().split(System.lineSeparator()).each {
line ->
if (line ==~ /.*org\.apache\.ofbiz\.base\.start\.Start.*/) {
exec { commandLine 'kill', '-9',
line.tokenize().first() }
}
}
}
}
}
While it might be considered a bug at first hand, I personnally think
this failure is more a symptom of a desperate endeavour which is to
guess how the system of a user is managing its processes. As a
consequence I will suggest to simply remove this task to not make false
promises to users and let them manage the processes on their system by
themselves. :-)
What do people think?
--
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761 070D 0ADE E100 9460 4D37