aboutsummaryrefslogtreecommitdiffstats
path: root/dumpwatch.zsh
blob: a0b3de5d7f2eae19a2f2da59f65976a9595f6a32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)