Email ourselves if something goes wrong

It would be cool if there was a way to e-mail ourselves if something went wrong.

For example, I use this on a PI and I don’t like to have to check everyday if it is working… If the electricity goes down, I’ll need to mount my HDD manually again. It would be cool to have an option to email ourselves if the synced folder is not in the correct path, or if there’s any other error.

Not even sure how this would work, just a suggestion.

To get an email when the Pi reboots, just put the command in crontab with @reboot.

You can use the API to get recent errors and send an email yourself, e.g. in a regular cron script.

If the electricity goes down, I’ll need to mount my HDD manually again.

I’m assuming you mean a disk attached to the pi via usb.

You shouldn’t need to mount it manually - just use /etc/fstab.


# <file system>                           <dir> <type>   <options>                              <dump> <pass>
/dev/mmcblk0p1                            /boot  vfat    defaults                                  0     0
/dev/mmcblk0p2                            /      ext4    errors=remount-ro,noatime                 0     1
UUID=A1A1A1A1A1A1A1A1                     /mnt/t ntfs-3g defaults,nofail,errors=remount-ro,noatime 0     0
UUID=b2b2b2b2-b2b2-b2b2-b2b2-b2b2b2b2b2b2 /mnt/u ext4    defaults,nofail,errors=remount-ro,noatime 0     2

Here there’s a disk with 2 partitions, 1 ext4 and 1 ntfs.

Specifying them by uuid and using the nofail option allows the pi to boot with or without the disk attached.

Reboot after power failure will remount the disk for you.

You may wish to look at hd-idle to spin doown the disk when not in use.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.