| Date: Wed, 27 Jan 2016 15:32:58 +0100
mourner, script to watch /dev for new keys
Diffstat:
A bin/mourner | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+), 0 deletions(-)
--- |
| t@@ -0,0 +1,23 @@
+#!/bin/bash
+#
+# mourner - inotify script to watch /dev for new keys
+#
+# ~ parazyd
+
+pattern='sd[b-z][1-9]$'
+coproc inotifywait --monitor --event create,delete --format '%e %w%f' /dev
+
+while read -r -u "${COPROC[0]}" event file; do
+ if [[ $file =~ $pattern ]]; then
+ case $event in
+ CREATE)
+ echo "Created $file..."; sleep 1
+ `pwd`/sacrist $file $event
+ ;;
+ DELETE)
+ echo "Removed $file..."; sleep 1
+ `pwd`/sacrist $file $event
+ ;;
+ esac
+ fi
+done |