0

Currently, there's a fairly complex Python script that manages several dozen processes across a few servers. Each individual process has the same setup/requirements:

  • Main process must come up and be monitored
  • Helper network process must come up and be monitored
    • If helper crashes, restart it
  • User must be able to issue a command that closes main and helper process, zips up log files, and cleans up after itself.
  • If main process dies, cores will likely have been generated, so zip up logs and cores as well as killing off the helper process

Right now, logs (stdout from the main process) and cores are written to /var/log/so-and-so/ which is a tmpfs partition to speed things up. Otherwise, the Python script drops PID files into /run/so-and-so/ to keep track of who's doing what.

The time has come where my users would like these processes to start themselves daily. Presumably, they'll want to have them die at certain times as well, but that's yet to requested.

I've never done anything more than fire up one single script with systemd, so I'm not sure how to make things interdependent, or if this task is an appropriate systemd project in the first place. So that's my question(s). Is this something systemd should be doing? And if so, what should it look like?

pdm
  • 101
  • 3
  • "...across a few servers." systemd can't handle that (with the proviso that with sufficient thrust even pigs can fly). Without more detail I'd consider using ansible with local simple systemd service definitions. – Mark Wagner Jul 02 '18 at 19:56

1 Answers1

0

As a wholly personal view there isn't any reason that you couldn't run this system using systemd that I can think of. In theory it would even be possible to do away with the helper process by the look of your description but that would be a design decision.

On the other hand, the non-privileged aspect that you describe could also be a candidate for supervisord's API so that you could grant permissions to users based on roles. This may be possible with systemd - it's certainly possible to run processes in userland with systemd - but it would depend on the complexity you want to expose to users.

Simon Greenwood
  • 1,343
  • 9
  • 12