From 86a3ca82c74c9109594b4d7c4a61f2d804b8ccc0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 13 Nov 2018 01:51:03 +0100 Subject: [PATCH] Monitor home for new files --- ansible.cfg | 1 + roles/tools/files/monitor_home.service | 9 +++++++++ roles/tools/tasks/main.yml | 12 ++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 roles/tools/files/monitor_home.service diff --git a/ansible.cfg b/ansible.cfg index 11d1f5e..b88bd6c 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -8,3 +8,4 @@ retry_files_save_path = $XDG_CACHE_HOME/ansible roles_path = ./roles:./galaxy display_skipped_hosts = yes display_ok_hosts = false +gather_subset = !all diff --git a/roles/tools/files/monitor_home.service b/roles/tools/files/monitor_home.service new file mode 100644 index 0000000..6bb0471 --- /dev/null +++ b/roles/tools/files/monitor_home.service @@ -0,0 +1,9 @@ +[Unit] +Description=Monitor home + +[Service] +Type=simple +ExecStart=/usr/bin/sh -c '/usr/bin/inotifywait -m $HOME $XDG_DATA_HOME $XDG_CONFIG_HOME -e create -e moved_to | while read i j k; do /usr/bin/dunstify -u CRITICAL -t 0 -a "File created in home" "$i$k"; done' + +[Install] +WantedBy=default.target diff --git a/roles/tools/tasks/main.yml b/roles/tools/tasks/main.yml index e9eb887..1aef012 100644 --- a/roles/tools/tasks/main.yml +++ b/roles/tools/tasks/main.yml @@ -70,7 +70,19 @@ dest: $XDG_CONFIG_HOME/systemd/user/ notify: - reload systemd +- name: monitor home service file + copy: + src: monitor_home.service + dest: "$XDG_CONFIG_HOME/systemd/user/" + notify: + - reload systemd - meta: flush_handlers +- name: enable monitor home + systemd: + state: started + scope: user + name: monitor_home.service + enabled: true - name: Clone password store git: dest: "$XDG_DATA_HOME/pass" -- 2.41.0