From 037e4f926438a0f66f5e30a7bffe2a0bd8787f9c Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Thu, 10 Sep 2015 14:11:59 +0200 Subject: Add dumpwatch.zsh to upload dumpdir files to server MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Johannes Löthberg --- dumpwatch.zsh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 dumpwatch.zsh diff --git a/dumpwatch.zsh b/dumpwatch.zsh new file mode 100755 index 0000000..a0b3de5 --- /dev/null +++ b/dumpwatch.zsh @@ -0,0 +1,18 @@ +#!/usr/bin/env zsh + +if [[ -z "$dump_host" ]]; then + dump_host=theos.kyriasis.com +fi + +if [[ -z "$dump_user" ]]; then + dump_user="$USER" +fi + +while read -r file; do + scp -q "$HOME"/dumpdir/"$file" "$dump_host":public_html/d/ + + url="https://$dump_host/~$dump_user/d/$file" + printf "Dumping file %s to %s. URL: %s\n" "$file" "$dump_host" "$url" + printf "%s\n" "$url" | xclip -selection clipboard + +done < <(inotifywait -me create --format '%f' "$HOME"/dumpdir) -- cgit v1.2.3-54-g00ecf