tmourner, script to watch /dev for new keys - coffin - secure lan file storage on a device
HTML git clone git://parazyd.org/coffin.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit cb97a7f533a108720132427c9c185c211851520b
DIR parent 79a780a5f4ce0274563b4b2933bb863dab226954
HTML Author: parazyd <parazyd@dyne.org>
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(-)
---
DIR diff --git a/bin/mourner b/bin/mourner
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