linux - Simple send/receive interface to a background Java service application -


i have headless java application perpetually runs in background, service/daemon suppose. it's running on linux , collects data, storing in database, on continuous loop.

it's started , stopped init.d script. starts jar running in background upon system start, , stops killing particular java process upon system shut-down. plus can access script manually start/stop, this:

sudo service my-java-app stop 

despite being primitive, has sufficed. i'm hoping use more elegant interface. allow me send commands (i.e. change data acquisition frequency , friendly termination), , request data (i.e. health check , statistics).

i've never done before , i'm looking guidance on start. app runs in background on headless linux, gui isn't suitable. i've thought of running http server , listening post , get, that's not simple implement or use in bash. i've thought there may virtual com port or create?? or text file write , app reads on interval?

i image end goal method execute commands in bash , have java application listening/attached somehow.

i had done once using sockets in java code. java application run either client or daemon. main() entry point checked whether socket open know if daemon running already. can have cli parameters if want launch daemon or send commands.

  • on daemon launch, open socket on specific port
  • on launch, check if socket open on specific port, , send messages if is.

note: implies choose fixed port, didn't way.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -