diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2022-11-22 14:59:13 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2022-11-22 14:59:13 +0800 |
commit | 88efdbc8e093c5ffeee1c414bf6c682e4faab075 (patch) | |
tree | 4f6a75a1d99e80529d45dbc755b9c9615f288acf /tools | |
parent | caa9323eae8ec54afd6158472ee71050ea584842 (diff) |
Add mail hook
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/sns/mastodon.sh | 12 |
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 | |||
3 | MAIL="$(cat)" | ||
4 | |||
5 | # Only execute the following script when mail receiver is mastodon@topo.tw | ||
6 | grep -qE "^To: .*mastodon@topo.tw[>]?$" <<<"$MAIL" || exit 0 | ||
7 | |||
8 | date >>~/Downloads/mastodon.log | ||
9 | echo $$ >>~/Downloads/mastodon.log | ||
10 | awk -v RS= 'NR>1' <<<"$MAIL" >>~/Downloads/mastodon.log | ||
11 | |||
12 | #awk -v RS= 'NR>1' <<<"$MAIL" | toot post >/tmp/mastodon.log | ||