{"id":21038863,"url":"https://github.com/revelaction/iflandown","last_synced_at":"2026-05-18T09:02:40.408Z","repository":{"id":64308297,"uuid":"465237042","full_name":"revelaction/iflandown","owner":"revelaction","description":"iflandown is a deamon tha truns commands after the wired LAN link is down for a given amount of time.","archived":false,"fork":false,"pushed_at":"2024-09-11T14:16:43.000Z","size":57,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-09T11:04:24.439Z","etag":null,"topics":["automation","daemon","ethernet","golang","lan","raspberry-pi","ups"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/revelaction.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-02T09:22:59.000Z","updated_at":"2024-09-11T14:19:55.000Z","dependencies_parsed_at":"2024-11-19T13:43:41.079Z","dependency_job_id":"a37b1f32-de03-4466-ac75-6ccea1dd3822","html_url":"https://github.com/revelaction/iflandown","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/revelaction/iflandown","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/revelaction%2Fiflandown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/revelaction%2Fiflandown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/revelaction%2Fiflandown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/revelaction%2Fiflandown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/revelaction","download_url":"https://codeload.github.com/revelaction/iflandown/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/revelaction%2Fiflandown/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33172173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T05:43:36.989Z","status":"ssl_error","status_checked_at":"2026-05-18T05:43:19.133Z","response_time":71,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","daemon","ethernet","golang","lan","raspberry-pi","ups"],"created_at":"2024-11-19T13:36:42.723Z","updated_at":"2026-05-18T09:02:40.371Z","avatar_url":"https://github.com/revelaction.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cp align=\"center\"\u003e\u003cimg alt=\"iflandown\" src=\"logo.png\"/\u003e\u003c/p\u003e\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/revelaction/iflandown)](https://goreportcard.com/report/github.com/revelaction/iflandown)\n[![GitHub Release](https://img.shields.io/github/v/release/revelaction/iflandown?style=flat)]()\n[![GitHub Release](https://img.shields.io/badge/built_with-Go-00ADD8.svg?style=flat)]() \n\n\n`iflandown` is a deamon that monitors the LAN link and runs commands if it is down for a given amount\nof time.\n\nAll/most linux devices should work. Tested on amd64, Raspberry Pi, odroid \n\n## Why\n\nYou can use `iflandown` to avoid filesystem corruption in your rapsberry\nPis, when they are connected to an Uninterruptible Power Supply (UPS). \n`iflandown` can safely stop the programs running and shutdown the Pi before it\nruns beyond the UPS time limit, avoiding thus risk of sd card corruption, in\ncase of a too long power outage.\n\nFor this to work, the home router shouldn't  be protected by the UPS, as it\nserves as the detection feature.\n\n## How it works\n\n`iflandown` checks each minute the LAN ethernet interfaces in\n`/sys/class/net/%s/carrier` to register the state of the link. \n\nIf a minimum of uptime minutes `Window` is not reached inside a defined period\nof time `Period`, `iflandown` executes the configured commands.\n\n# Installation\n\nOn Linux, macOS, and FreeBSD and Windows you can use the [pre-built binaries](https://github.com/revelaction/iflandown/releases/) \n\nIf your system has a supported version of Go, you can build from source\n\n```console\ngo install github.com/revelaction/idlandown@latest\n```\n\n## Usage\n\nEdit the `iflandown.toml` file with your preferences:\n\n```toml\n# The past period of time, starting each minute, that is considered to search\n# for at least `Window` minutes of LAN (ethernet) uptime \n#\n# It is measured in minutes.\n#\n# iflandown will also wait this time before starting to make decisions.\n# \n# This number of minutes should match roughly the capacity of your UPS to\n# serve your devices after a power outage.\nPeriod = 30\n\n# The minimum number of minutes in the `Period` of time that are necessary to\n# have been \"up\" in order to avoid the sequence of commands to run. \nWindow = 5\n\n# The commands to run\n#\n# Separate arguments from the main command and include full paths\n# \n# sudo commands are possible\nCommands = [[\"ls\", \"-alrt\"], [\"sudo\", \"/bin/systemctl\", \"stop\", \"myservice\"]]\n```\n\nAnd run the command in the same directory as the `iflandown.toml` file:\n\n```console\niflandown\n```\n\nTo run the commands without checks (to test the commands, permissions), run:\n\n```console\niflandown --nocheck\n```\n\n## systemd service\n\nThere is also a systemd service file to run `iflandown` as a service. \nJust change in the file the user name `\u003cuser\u003e`\n\n## Run commands as root without passwords\n\nTo let `iflandown` run commands with sudo and no password, add one\nline in the `/etc/sudoers` file for each command and arguments that you\nconfigured in `iflandown.toml`.\n\nFor example, to let `iflandown` stop the `systemd` service `myservice`,\nadd this line:\n\n```\n    \u003cuser\u003e ALL = (root) NOPASSWD: /bin/systemctl stop myservice\n```\n\nWhere `\u003cuser\u003e` is the user that will run the `iflandown` binary/service.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frevelaction%2Fiflandown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frevelaction%2Fiflandown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frevelaction%2Fiflandown/lists"}