dotfiles/.local/bin/scripts/netkeeper

16 lines
577 B
Bash
Executable File

#!/bin/sh -e
# Keeps the Internet at bay
if test -e "$JOURNAL"; then
# TODO ask previous
echo "What do you want to do? Check your journal!" >&2
mins=${1:-10}
while test $(echo "$intention" | wc -c) -lt $mins
do read intention
done
jrnl intentions "$intention"
sudo nft flush chain inet filter outall
sudo nft add rule inet filter outall meta hour "$(date +%H:%M)"-"$(date +%H:%M --date="${mins}min")" accept
#expr \( "$1" \> 40 \) \* 10 \| "$1"
apprise $(pass service/apprise/intentions | head -1) -t "janeks intention for ${mins} min" -b "$intention"
fi