Browse Source

Start to use inotifywait

poka 11 months ago
parent
commit
30e136f3ea
1 changed files with 22 additions and 0 deletions
  1. 22 0
      wait_actions/sync_ipfs.sh

+ 22 - 0
wait_actions/sync_ipfs.sh

@@ -0,0 +1,22 @@
+#!/bin/bash
+
+MY_PATH="`dirname \"$0\"`"              # relative
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`"  # absolutized and normalized
+
+YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
+IPFSNODEID=$(ipfs id -f='<id>\n')
+
+#toWatch="$MY_PATH/../wallets_swarm/.$IPFSNODEID"
+toWatch="./test"
+
+inotifywait -r -q -e create,close_write,delete -m "$toWatch" |
+while read -s -r directory event filename; do
+
+	## Action à réaliser lors du changement d'état de ce dossier
+	## ipfs_swarm_wallets_refresh
+
+	echo "$filename $event in $directory !" # >> /tmp/g1sms.log
+
+done
+
+exit 0