Shutdown server from Meteor app

I know there are ways to restart the app using managers such as PM2 etc but is there a way to shutdown the whole app and underlying container gracefully ? My use case is to have a Nginx spin up meteor app containers on demand and shutdown at logout. I know that there may be other ways to work around such a use case but I want to know solutions for this specific use case. TIA