diff options
author | Johannes Löthberg <johannes@kyriasis.com> | 2015-09-10 14:11:59 +0200 |
---|---|---|
committer | Johannes Löthberg <johannes@kyriasis.com> | 2015-09-10 14:11:59 +0200 |
commit | 037e4f926438a0f66f5e30a7bffe2a0bd8787f9c (patch) | |
tree | ecd870ec73dec9ca384a4714e4e696a43fe97a45 | |
parent | d1d23970a07ba8ef762603aaf1554993612b94cf (diff) | |
download | bin-037e4f926438a0f66f5e30a7bffe2a0bd8787f9c.tar.xz |
Add dumpwatch.zsh to upload dumpdir files to server
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
-rwxr-xr-x | dumpwatch.zsh | 18 |
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) |