Skip to content

Instantly share code, notes, and snippets.

@manio
Created September 6, 2023 15:29
Show Gist options
  • Save manio/a78a83ffdd81200eb367c8d8d0e9771a to your computer and use it in GitHub Desktop.
Save manio/a78a83ffdd81200eb367c8d8d0e9771a to your computer and use it in GitHub Desktop.
linux systemd service for listening on UDP with netcat and constantly putting the data in temporary file
# This is a systemd service file to be able to monitor battery level on a windows laptop
# The Windows side is described in this gist:
# https://gist.github.com/manio/95ad95dc5eba708b12d658f2e6f478ea
# This unit is listening on specified UDP port and it is writing data
# to specified output file. It is overwriting the data with every new
# UDP frame.
[Unit]
Description=laptop battery monitoring daemon
After=local-fs.target
[Service]
Type=simple
Restart=always
RestartSec=1
ExecStart=nc -l -u -W1 -p772
StandardOutput=file:/tmp/laptop-battery
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment