Print, filter, and react to udev events as JSON
Project description
udev-cli
Print udev events, filter udev events, and run commands on udev events. udev is a system of events when hardware devices are plugged into a computer on linux.
This is unreviewed AI-generated code. But will become more reviewed if people use it.
Motivation
I have a tried to use udev a few times. But I always find it difficult to actually get my events to fire and debug what is going on. I've decied to just listen to events myself and trigger events rather than mess ith rules.
Alternatives and prior work
udev-monitor is a pypi project which is very similar. However, it could not filter by UUID, so I decided to vibe code something up.
udev itself has a rule system and
udevadm monitor can output events from udev put does not output JSON. I am also concerned about buffering.
This uses pyudev internally. You could achieve this functionality with a little python script using pyudev and do other things - but it would involve a little more debugging to understand what is going on.
Installation
pipx install udev-cli
Usage
Print all udev events: udev-cli. You can use jq to help you work out what you want to match.
block device events only: udev-cli -s block
block devices added: udev-cli -s block -a add
match specific UUID: udev-cli -f ID_FS_UUID b9335c96-...
match any UUID in file: udev-cli -f ID_FS_UUID @/etc/backup-uuids.txt
run a command: udev-cli -s block -a add -f ID_FS_UUID @uuids --run ./backup.sh
About
I am @readwithai. I am making tools for reading and agency with and without AI. I also make a lot of small tools related to productivity. If this tool is useful you might like follow me on github or X.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file udev_cli-0.1.0.tar.gz.
File metadata
- Download URL: udev_cli-0.1.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ffa0bc26ae4793e86ec1e9df05f1fe0c036a9215fa309908537d3f6aa38597b
|
|
| MD5 |
95e5bf66a3a158d588afaf9eb869cd95
|
|
| BLAKE2b-256 |
bd018abcffb381eb6781d97de4e8256f37ebdca59b0b15c3e67a23b6be0e506c
|
File details
Details for the file udev_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: udev_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5de88b0075f9ba25ea970a89547ac27a96813c9f96b7d009fd6a145c31a37bd
|
|
| MD5 |
7696e3fcbbec0dcf31af44d7c4087eba
|
|
| BLAKE2b-256 |
b17aa19ae4a6d0b097c560c21118924ceaa996e7b9755be581119d25701acf54
|