title: How to nicely close a background Qt6 console application from command line
body: <p>I wrote a Qt 6.2.0 console application under Ubuntu 20.04 that runs as a service (in background) without any interaction with the user. Sometimes I need to close the application but without killing it, because it has to disconnect nicely from the other devices.</p>
  <p>I'm able, say, to install a webserver, host a web page, create a WebSocket channel, place a button into the page, send a command to the application and then take the action required.</p>
  <p>Honestly, it seems an overkill to me.</p>
  <p>So I tried to send a <code>SIGQUIT</code> signal to the application:</p>
  <pre><code>kill -3 &lt;pid&gt;
  </code></pre>
  <p>but this leads to a kill, indeed.
  I found <a href="https://gist.github.com/azadkuh/a2ac6869661ebd3f8588" rel="nofollow noreferrer">this</a> code that should catch the signal and nicely close the application.</p>
  <p>With the command above the behavior is still the same:</p>
  <pre><code>12:04:43: The program has unexpectedly finished.
  12:04:43: The process was ended forcefully.
  12:04:43: /home/mark/myproject crashed.
  </code></pre>
  <p>Is there a reliable way to properly shutdown an application (i.e. calling destructors) from command line?</p>