Manually

OS:

🐧 Linux

Follow this guide to set up Desomnia on Linux manually, with full control over the binary placement and service configuration.

Prerequisites

Desomnia requires the .NET Runtime. If it is not provided as a package by your distribution, use the official script to download and install it into the default location, where it will be found automatically:

curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 10.0 -runtime dotnet --install-dir /usr/share/dotnet

For monitoring network services, the libpcap library is required. It is usually already present on most distributions. If it is missing, install it via your package manager. On Debian-based distributions (Ubuntu, Raspbian, etc.):

apt-get install libpcap0.8t64

In order to automatically configure your network interface for Wake-on-LAN and temporarily assign static address mappings, Desomnia additionally needs the following optional network tools:

apt-get install ethtool iproute2

Portable mode

To verify that Desomnia is compatible with your system and network infrastructure before committing to a full installation, you can run it in portable mode.

Download the appropriate binary for your platform from the GitHub Releases page. Set the executable permission with chmod +x ./desomniad, then create a suitable configuration file and place it next to the binary. Additional plugin archives can be placed in a subdirectory named plugins. Run the application as root with ./desomniad.

Filesystem layout

For a persistent installation, use the following locations in alignment with the Filesystem Hierarchy Standard (FHS):

/usr/sbin

Drop the binary for your platform and architecture here so it can be found automatically. Set the executable permission with chmod +x /usr/sbin/desomniad.

/etc/desomnia

Put a suitable monitor.xml into this location, to tell Desomnia what to do. You can also create a NLog.config file here, to configure additional logging, beside the console output.

/var/lib/desomnia/plugins

Here you can drop your additional plugins, which will be loaded when the programs starts.

/var/log/desomnia

Here you will find the log files, if you enabled file logging in the NLog.config and used ${var:logDir} as base path.

Service configuration

Create a systemd service unit to manage automatic start and stop:

/etc/systemd/system/desomnia.service
[Unit]
Description=Desomnia

[Service]
ExecStartPre=find /var/log/desomnia/ -type f -delete
ExecStart=desomniad
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

The ExecStartPre statement clears the log folder on each start, which is useful for debugging.

Starting and stopping

After creating or modifying the configuration file, reload systemd with systemctl daemon-reload. To start Desomnia automatically with the system, enable it with systemctl enable desomnia. Start the service with systemctl start desomnia and stop it gracefully with systemctl stop desomnia.

Journal

The INFO-level console output shows the most important actions Desomnia takes — such as waking remote hosts or sending knock packets — giving a quick overview of what the service is doing at any point in time. Warnings and errors are included as well.

To follow the live output from the systemd journal, run:

journalctl -u desomnia -f -n 80