Last active
February 13, 2020 16:13
-
-
Save epcim/39449dc7ce926bafb476dad99cd5205e to your computer and use it in GitHub Desktop.
udev rules ordered interface
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#if [ $# -lt 1 ]; then | |
# echo "Usage: $0 prefix [initial] [database/file] " >&2 | |
# exit 1 | |
#fi | |
key="${1:-"eth"}" | |
initial="${2:-0}" | |
datfile="${3:-/run/indexerdb_$key}" | |
lockfile="${datfile}.lck" | |
( | |
flock -x 9 | |
num=$initial | |
if [ -e "$datfile" ]; then | |
read -r num < "$datfile" | |
fi | |
next=`expr $num + 1`; | |
echo $next > "$datfile" | |
echo "$key$num" | |
) 9> "$lockfile" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="?*", ATTRS{class}=="0x0200*", PROGRAM="/opt/bin/indexer eth" NAME:="%c" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment