Select OS in GRUB2 Headlessly

Ubuntu and Linux Mint both support the command grub-reboot <num> (where num is the menu entry number, starting from 0 as the first item).

To remove Memtest options, the following can be ran on Ubuntu or Linux Mint:
$ sudo apt-get remove memtest86+

The above will automatically trigger an update to Grub2, but that can also be called manually with:
$ sudo update-grub

To overwrite the MBR on the primary HDD with Grub2, from within Linux Mint or Ubuntu:
$ sudo grub-install --boot-directory=/ /dev/sda
$ sudo update-grub