Linux shutdown on laptop lid close
The challenge
Using a laptop as a baby server, it had the behaviour of going in to standby when the lid close. The Operating system in this case is Proxmox.
The solution
Using nano or equivalent, update
Look for the setting HandleLidSwitch, by default it is set to suspend. Update this to be ignore, lile the below example
Now restart systemd-logind to load this new setting.
You can confirm that the setting worked by checking the status
There will be multiple entries showing, just make sure that the lid switch is not listed. Below is an example entry for the lid.
systemd-logind[16784]: Watching system buttons on /dev/input/event1 (Lid Switch)