[go: nahoru, domu]

Skip to content

Freedesktop internet-monitor continuously checks for internet connectivity and creates a desktop notification when the internet is unavailable.

Notifications You must be signed in to change notification settings

fredricocalamari/internet-monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Freedesktop Internet Monitor

The Freedesktop Internet Monitor is a simple and efficient systemd service written in C, designed to monitor internet connectivity. It pings google.com at 5-second intervals, and after 3 failed attempts it alerts users of any connectivity issues with a desktop notification. Originally conceived in Python by ChatGPT 3.5 this tool has been refined and rewritten in C by ChatGPT 4 to minimize resource consumption. It uses under 1.4MB of memory and practically no CPU running on my computer. This was written to be responsive, so if it is not to your liking you can modify the sleep timer in internet-monitor.c before compiling.

Features

  • Efficient Connectivity Monitoring: Checks internet access by pinging google.com every 5 seconds. Notifies after 3 failed attempts (15 seconds of no internet connectivity).
  • Freedesktop Compatible: Generates desktop notifications within GNOME or KDE environments upon detecting connectivity issues.
  • Optimized Performance: Program is very lightweight to ensure minimal resource usage, ideal for any system.
  • Broad Compatibility: Tested and confirmed operational on Arch Linux with GNOME 45. Very simple C code = wide Linux support.

Getting Started

Arch Linux Installation

  1. Install Dependencies:

Ensure dbus is installed:

sudo pacman -Sy dbus
  1. Clone and Navigate to Repository:
git clone https://www.github.com/fredricocalamari/internet-monitor internet-monitor && cd $_
  1. Build and Install Package:
makepkg && sudo pacman -U internet-monitor*.zst
  1. Enable and Start the Systemd Service (User Mode):
systemctl --user enable internet-monitor.service && systemctl --user start internet-monitor.service

Repeat the above command for each user account that requires the internet monitor service.

Installation on Other Distributions

  1. Download and Prepare Files:

Download internet-monitor.c and internet-monitor.service into a desired folder and navigate into it:

cd path/to/folder
  1. Compile the Source:
gcc internet-monitor.c -o internet-monitor
  1. Install the Binary and Service File:

As root, execute the following commands:

chmod 755 internet-monitor && cp internet-monitor /usr/bin/
chmod 644 internet-monitor.service && cp internet-monitor.service /usr/lib/systemd/user/
exit
  1. Enable and Start the Service (User Mode):

As an unprivileged user, enable and start the service:

systemctl --user enable internet-monitor.service && systemctl --user start internet-monitor.service

Customization

To modify the ping interval, simply edit the internet-monitor.c file, changing the sleep duration to your preferred interval, and recompile the program. This flexibility allows the monitor to be adapted to various user requirements and network conditions.

Written with the help of ChatGPT4

About

Freedesktop internet-monitor continuously checks for internet connectivity and creates a desktop notification when the internet is unavailable.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published