I would like to have SCALE send an email at startup (after booting). The reason is that SCALE rebooted randomly recently due to a memory error that cause a kernel panic. I don’t know if it was a one-off fluke or a more serious problem; so I would like to get notified whenever SCALE boots. Does anyone know how to do this?
If I can send an email from the command line, then I can do so at startup by adding an INIT script under System, Advanced. So I just need to know how to do so from the command line.
Incidentally, I have learned how to send an email from the SCALE CLI as discussed here: Mail |
However, this does not help because, at least as I understand it, the SCALE CLI is interactive only and cannot be scripted.
I should have thought of this, but the OPNsense router that provides internet access to my house is virtualized as a VM on the SCALE server that’s the subject of this post. Since it takes a while for OPNsense to boot up after SCALE boots up, it’s necessary to pause the INIT script before sending the email in order to give OPNsense time to boot, or else the email doesn’t send. I chose a 600 second (10 minute) delay, which was overkill in my case.
In case anyone else is in this situation, here is the modified script that delays before sending the email: sleep 600 && echo “The server booted up at $(date)” | mail -s “TrueNAS Bootup Notice” someone@example.com