+1 This is currently also used by the demos because "ofbiz --shutdown" does not work with multiple instances
https://svn.apache.org/repos/asf/ofbiz/tools/demo-backup/trunk.sh Of course resolving "ofbiz --shutdown" issue would be better. But I guess few people use multiple instances in production on the same server. Jacques Le 17/03/2019 à 22:39, Taher Alkhateeb a écrit :
I think I might prefer to keep it. Perhaps adjusting the ps command might better solve the issue. I use this feature regularly myself. On Sun, Mar 17, 2019, 11:59 PM Mathieu Lirzin <[email protected]> wrote: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
