I have been doing some experimenting in this area recently so I thought I would share a bit. My goal is to have a completely headless installation that I can operate with just physical buttons, encoder for jogging etc. I will be running the same job over and over so the file only needs to be specified very infrequently. Initially I will have to SSH in to start it and set the file of course.
To start LinuxCNC running with no display and then be able to close out the terminal leaving it running, set the [DISPLAY]DISPLAY value to 'dummy' in your .ini file. Then you can make a copy of the startup script file /usr/bin/linuxcnc (I copied it to /usr/bin/linuxcnc-headless) and comment out a couple of lines right near the end. Commenting these out will skip the step where it would normally wait for user input to continue, and then also skip the shutdown procedure:
ffs.... what is wrong with this forum??!?!?!?!?!! EVERY time I post here (especially to edit an existing post) the format gets all messed up or something disappears!!! It has been like this for years. This time I had a whole explanation written out and now most of it is gone, and right now I cannot be bothered writing it all again sorry. I will just put the video link and the github link, it might explain the overall idea well enough, let me know if anything is not clear and maybe I can answer after I calm down.
github.com/iforce2d/linuxcnc-gcode-server