Sending Email when terminal is exit in which the golang application is runnin

You won’t be able to as we said already. Its a technical limitation about how processes and its children are managed by the operating system.

i agreed to that thats why i said “hence there is no solution to it” however goerge suggested monit as solution which is not feasible for this usecase

I still think, that external tooling might be able to help you to solve your problem.

  1. On start of your program write a “pid file” to a known place
  2. On clean exit remove that file.

A background service occasionally checks the location for pid files and checks if each of them is alive. Send an email for each pid file that has no living process.

thanks for the clarification!!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.