I'm working on a c++ desktop application involving database management, and i'm facing few issues on how to start/stop the postgres server automatically after the application starts/stops.
we could register the service during the installation as "automatic" but if the application is off it would be a waste of resources. manually it could be done via the svc manager or the command line (pg_ctl -D ... start), but desktop applications do it automatically.
the general ideas i've been able to find on the internet were to register it as a service then start/stop it manually or run it from inside the code by running the command.
i would be very grateful if anybody could point me to a guide on the proper way to do it, or tell me how it's done.