Well, I'd still treat it like any other "Client App". It does make more sense for it to be a long-lived daemon though.
If it's the kind of thing where you can run it once in a while:
$ bin/myagent --daemon
.. while 1
.... exec bin/myagent --report
.... sleep 300
$ bin/myagent --report
.. hit the Database
.. send to Web App
.. exit
Or maybe you want to be able to send requests to the daemon from outside? The issue there would be firewall rules generally.
Personally, I highly recommend you avoid creating a smart daemon and recommend the approach above if it will work at all. Embedding a web server (or similar) tends to create all kinds of issues, including performance, firewll, memory issues, logging, etc.
I originally wanted bi-directional communication, since it would simplify command processing. But you're right, that's just asking for all kinds of problems.
It'll be easier to have the client poll the server to find out updates or new commands.
If it's the kind of thing where you can run it once in a while:
Or maybe you want to be able to send requests to the daemon from outside? The issue there would be firewall rules generally.Personally, I highly recommend you avoid creating a smart daemon and recommend the approach above if it will work at all. Embedding a web server (or similar) tends to create all kinds of issues, including performance, firewll, memory issues, logging, etc.