Skip to content

Network Type

jbaumann edited this page Jan 6, 2022 · 5 revisions

Mandatory Options

The network type is used by setting the type accordingly:

[my new network check]
type = network
network = network interfaces to be checked
repair = repair command

The network type needs the following options to be set:

Option Explanation
network The network interfaces listed here (space-delimited) are checked and as long as at least one the interfaces is connected, the check is successful
repair This command is executed when the check was unsuccessful for longer than the set timeout

The network check is Linux-specific. We first check whether a device of the given name exists in /sys/class/net/, and in the next step read /sys/class/net/<if_name>/flags. If this file contains a 1, then for all intents and purposes it is active.

This leads us to the following definition for the command option:

network = eth0 wlan0

The next step is the repair action. We simply restart our networking with a systemctl command:

repair = sudo systemctl restart networking

Example

[my new network check]
type = network
network = eth0 wlan0
repair = sudo systemctl restart networking

Options overwriting defaults

The following options overwrite default values from the [general] section, if need be:

Option Explanation
fallback This is the fallback action that is executed if repairing was unsuccessful
sleep time The daemon sleeps between checks of the current configuration for this time in seconds.
timeout The timeout defines the maximum allowed time between successful checks. If this is exceeded, then a repair action or a fallback action is executed