aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2022-11-22 14:59:13 +0800
committerHsieh Chin Fan <pham@topo.tw>2022-11-22 14:59:13 +0800
commit88efdbc8e093c5ffeee1c414bf6c682e4faab075 (patch)
tree4f6a75a1d99e80529d45dbc755b9c9615f288acf /tools
parentcaa9323eae8ec54afd6158472ee71050ea584842 (diff)
Add mail hook
Diffstat (limited to 'tools')
-rwxr-xr-xtools/sns/mastodon.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/sns/mastodon.sh b/tools/sns/mastodon.sh
new file mode 100755
index 0000000..1118c20
--- /dev/null
+++ b/tools/sns/mastodon.sh
@@ -0,0 +1,12 @@
1#! /bin/bash
2
3MAIL="$(cat)"
4
5# Only execute the following script when mail receiver is mastodon@topo.tw
6grep -qE "^To: .*mastodon@topo.tw[>]?$" <<<"$MAIL" || exit 0
7
8date >>~/Downloads/mastodon.log
9echo $$ >>~/Downloads/mastodon.log
10awk -v RS= 'NR>1' <<<"$MAIL" >>~/Downloads/mastodon.log
11
12#awk -v RS= 'NR>1' <<<"$MAIL" | toot post >/tmp/mastodon.log