aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2015-09-10 14:11:59 +0200
committerJohannes Löthberg <johannes@kyriasis.com>2015-09-10 14:11:59 +0200
commit037e4f926438a0f66f5e30a7bffe2a0bd8787f9c (patch)
treeecd870ec73dec9ca384a4714e4e696a43fe97a45
parentd1d23970a07ba8ef762603aaf1554993612b94cf (diff)
downloadbin-037e4f926438a0f66f5e30a7bffe2a0bd8787f9c.tar.xz
Add dumpwatch.zsh to upload dumpdir files to server
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
-rwxr-xr-xdumpwatch.zsh18
1 files changed, 18 insertions, 0 deletions
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)