Can I have my EmonPI execute a backup, and email it to me automatically?
Not out of the box, no.
There are a number of threads on backup strategies.
But none of the ones I’ve seen work on current emoncms, so to save time, the simplest working approach seems to be to set up an NFS server somewhere on your local network that the emonPI’s IP address has permissions to (configure your network to give the emonPI a constant address!) and put
cd /opt/emoncms/modules/backup && ./emoncms-export.sh nfs 192.168.0.1:/media/usbstick/emoncms
into a crontab or a cron.daily (or weekly) file.
Emailing the backup file directly from the emonPI may be tricky because it doesn’t usually have a way to send email configured. It’s not impossible to do it by setting something up to log into a mailserver and send an attachment, using python’s email and smtplib modules for example, but it’s extra work which you might be able to avoid.
I think none is a bit of a stretch.
For instance, this should still work (2nd on the search list) but is unsupported emonCMS backup example to NAS network drive
That is still only doing a backup to a nfs share and in a more complicated and fragile way. Stuff like
rm $(find ...) is dangerous: consider what happens if someone creates a file with a space in its name followed by /vmlinuz or similar.
It offers little over putting the crontab line I suggested.
I’m not suggesting it does, but saying it doesn’t work, is inaccurate.
So how does it send email?
Ah, no it doesn’t send email, but you said they didn’t work, which they do, just don’t do what the OP asked, for which you didn’t offer a solution (just a variation on saving a file elsewhere).