Sending email on system powerup and shutdown

This is a WIP - Shutdown emails aren't being dispatched correctly.

While working from home I sometimes find myself logging into my remote workspace to be greeted with the KDE logo splash-screen. I found that it would be nice and geeky if I got an email whenever my workstation shuts down and powers up. Let's jump straight into it.

Installing packages

Let's go ahead and install postfix and mutt

Tweak postfix's configuration

Fire up /etc/postfix/ on your favourite editor and set something similar to:

You can use postfix to check your configuration validity

Go ahead and start/enable the postfix service.

Sending emails on power events

Create the script (for instance at /scripts/) that will receive the power event, for instance name it

Set the correct permissions

Create the systemd services, for the power off hook lets name it on_power_off.service and set the contents to:

For the power on script, on_power_on.service, write:

Finally, set the service file permissions, copy over files, and enable services:

As mentioned above I still have issues with the shutdown script, if you have anny suggestions leave a comment (WIP). Also I don't remember where I saw the original scripts on stackoverflow so I am missing a reference.