Application plugin: unixStartScript doesn't save pid file

plugins

(Ari Maniatis) #1

The unixStartScript shell script for starting an application built with the application plugin can be found here.

Unfortunately the script is a little simplistic and is incapable of stopping the application.

Has anyone written a better script in init.d style, which can start and stop the application? Importantly it needs to be able to save a pid file somewhere in order to be able to stop the right process.

  • Should this be logged as a feature request to the project?
  • does anyone have a robust script already for this purpose?

(boulik) #2

Some inspiration could be found here.


(Ari Maniatis) #3

Thanks for that. I ended up with this: https://gist.github.com/ari/fd02802a13f8126211ec0ac44f3c7e16

Its built for my environments (OSX and FreeBSD) but should work on Linux. I made some changes to the gradle script:

  1. Ripped out everything Windows (70% of the complexity in the script is just for cygwin: let Windows use .bat instead…)
  2. Simplified a lot of the path detection code (I don’t understand the old complexity, but it isn’t needed in my environment)
  3. Save the PID in a file
  4. …which let’s us stop the application as well as starting it

Feel free to use any parts of this script for whatever purpose. Consider it released under the Apache License 2.