Automation Posts

Force Hard Drives to Sleep on Ubuntu 14.04

Activate Num-Lock at Boot on Ubuntu 14.04

One of the more important traits of a good home server is low power consumption. Hard drives can account for a big chunk if not the majority of power usage of a home server depending on the number of drives. Most hard drives can be put into sleep or stand-by mode to reduce power usage dramatically. Western Digital drives require a more forceful method which is where hd-idle tool comes into play. Hd-idle is a simple tool that can force both SATA and USB hard disk devices into stand-by mode.

ESP8266: Wire & Configure

Wire & configure ESP8266-07 Wi-Fi Module

Before attempting to use ESP8266 Module with a microcontroller like Arduino it is a good idea to test and get familiar with it by using a USB-to-Serial converter. With the converter AT commands can be issued directly to the module. Since some functions are not available on older firmware versions it is advisable to flash ESP8266 Wi-Fi module firmware to the latest version before proceeding to configure it.

Mount Filesystem Partitions in Arch Linux

Mount Filesystem Partitions in Arch Linux

On Arch Linux non-system partitions are not mounted automatically. Partitions have to be mounted in fstab or systemd mount scripts. Mounting in fstab is the more traditional method and is still used because of it’s simplicity and convenience. Mounts in fstab are converted to native systemd mounts so there is no major benefit to mount with systemd at this time. After the system partitions have been mounted you can install MHDDFS or another virtual pool volume.

Custom Dynamic DNS Service on Arch Linux

Setup Custom Dynamic DNS Service on Arch Linux

DDNS or Dynamic Domain Name System service makes reliable remote access without a static IP. The setup consists of the client script that runs on the Linux machine and the back-end service that is hosted on a remote server. The client periodically sends it’s own external IP to the remote server. The remote server will then be able to redirect to the dynamic IP of the local client. If you do not have a remote server with a static IP to host your custom service you can instead setup No-IP DDNS on Arch Linux. The advantage of a custom Dynamic DNS server is that it remains under your control and there are no limitations as with free services.

Install Copy Cloud Sync in Command Line on Arch Linux

Install Copy Cloud in Command Line on Arch Linux

Copy Cloud service currently offers 15 GB out of the fox for free. This alone is better than most services. For example if you setup Dropbox on Arch Linux you will only be getting 2 GB to start. With Copy it’s also possible to gain an extra 5 GB per referral up to 25 GB of additional storage compared to 16 GB maximum with Dropbox. Before you install Copy, sign up for a copy account with a referral link which will get you 5 GB extra storage.

Install Dropbox in Command Line on Arch Linux

Dropbox Command Line Arch Linux

Dropbox is one of the few major Cloud storage providers to offer a Linux client. It is normally set up as a GUI application but with the help of the Dropbox CLI tool it can be used fully from Command Line. This is particularly useful for headless servers. First step is to create a Dropbox account that will be later used to link to the Dropbox Linux Client.

Configure Buzzer Alarm Notifications on Arch Linux

buzzer-notification

Many motherboards especially older or higher end ones have a small speaker or more commonly a piezoelectric buzzer that can be used as an alarm. This can be very useful as a last resort for alerting users of serious issues when other notification methods fail to get the user’s attention.

Kodi Shared MySQL / MariaDB Database

Kodi MySQL Database on Arch Linux

A centralized MySQL or MariaDB database allows any number of Kodi clients to share the same media library and to be constantly in sync with each other. This also has potential to greatly improve scraping performance since only a single database needs to be updated. Most useful feature is probably the synced watch and resume counter which allows resuming of paused media from any client.

Configure Command Line Notifications on Linux

terminal-notification

Terminal notifications are not very useful these days since GUI is used far more often than command line. In any case it can be handy in some scenarios and it is good to know that no matter the mode of interaction the notification will always reach the user.

Configure XBMC / Kodi Notifications on Linux

kodi-notification

There are many reasons to set up notifications on certain events such as SMART error. Kodi / XBMC has a simple notification system that can be invoked programmatically or via a HTTP request. Before notifications can be received you will first need to install Kodi on Arch Linux and know the IP address and port on which it Kodi is reachable. It would be helpful to configure static IP on Arch Linux or setup static IP on Ubuntu Linux since then the IP would stay constant.

Configure Email Notifications on Arch Linux

arch-linux-email-logo Email system notifications can be used to warn of system issues like failing hard drives or failed backup scripts. To send emails a mail server can be configured but it is more complicated than it needs to be for simple notifications. Another issue with a local mail server is that some ISP’s may be blocking outbound emails making this method potentially unreliable.

A simpler alternative is to let an external mail service like Gmail send the actual email. To achieve this s-nail mail processing system will be used with the optional SMTP extension. The downside of this approach is that you will need to store you password in a plain text configuration file and allow “less secure apps” in Google settings. To avoid compromising the primary email account I opted to create a dummy account just for sending system notifications. This way, even if the Gmail account is compromised there is no real harm as no Emails are stored in that account.

Configure Automated SMART Checks on Arch Linux

arch-linux-smartmontools

SMART tests can give an early warning of impending hard disk failures. Tests can be run manually but this is inconvenient and results are not available immediately. Thankfully smartd can be used to run these tests automatically and email if any warnings occur. Before configuring automatic SMART monitoring you need to install smartmontools and check hard drives for SMART errors to make sure there are no failing hard drives. Smartmontools package also includes smartd daemon which will be used to run SMART tests automatically.

Check Hard Drives for SMART Errors on Arch Linux

hard-drive-spindle

SMART tests can give an early warning of impending hard disk failures. On most Linux distributions smartmontools package can be used to execute SMART scans. The package consists of smartctl utility which controls and monitors SMART disks and systemd daemon. Only smartctl is needed to run SMART tests manually but smartd is also required to Configure Automatic SMART Error Checks on Arch Linux.

Install Headphones on Arch Linux

Headphones and Arch Linux logo

Headphones is an automatic music downloader and manager. It is equivalent to CouchPotato or Sonarr but for music. For improved security it is installed under it’s own user and group. Backing up settings and the library is very simple and only requires a database and configuration files to be saved. The one major weakness of Headphones is that it uses MusicBrainz public mirror by default. The MusicBrainz public mirror is slow and unrelaible. This problem can be solved by using alternative server, either free or paid or running your own my setting up MusicBrainz VM Server with QEMU.

Force Hard Drives to Sleep on Arch Linux

arch-linux-wd-usb

Hard drives can account for a big chunk if not the vast majority of power usage in home servers depending on the number of drives. Most hard drives can be put into sleep or stand-by mode to reduce power usage dramatically with standard Linux tools. Western Digital drives and many external USB drives however require a more forceful methods. Fortunately hd-idle can spin down any SATA or USB drive.