bin: refine walli script
This commit is contained in:
parent
9d8e684bcf
commit
c0fa7576ef
|
@ -72,7 +72,7 @@ mkdir -p ~/.mixxx
|
||||||
ln -s -t ~/.mixxx ${XDG_DATA_HOME:-$HOME/.local/share}/mixxx/* ${XDG_CONFIG_HOME:-$HOME/.config}/mixxx/*
|
ln -s -t ~/.mixxx ${XDG_DATA_HOME:-$HOME/.local/share}/mixxx/* ${XDG_CONFIG_HOME:-$HOME/.config}/mixxx/*
|
||||||
|
|
||||||
highlight "Block internet at night & on weekdays in the morning to force focus"
|
highlight "Block internet at night & on weekdays in the morning to force focus"
|
||||||
walli 22
|
walli 22 --save
|
||||||
|
|
||||||
highlight "Cron logging"
|
highlight "Cron logging"
|
||||||
echo 'cron.* /var/log/cron.log' | sudo tee /etc/rsyslog.d/60-cron.conf
|
echo 'cron.* /var/log/cron.log' | sudo tee /etc/rsyslog.d/60-cron.conf
|
||||||
|
|
|
@ -5,9 +5,11 @@ time9=$(date -u -d "$(date -d 09:00)" +%k)
|
||||||
# Always allow local connections - https://serverfault.com/a/550278
|
# Always allow local connections - https://serverfault.com/a/550278
|
||||||
sudo iptables -A chain-times -m owner --uid-owner janek -d 192.168.1.0/24 -j ACCEPT
|
sudo iptables -A chain-times -m owner --uid-owner janek -d 192.168.1.0/24 -j ACCEPT
|
||||||
sudo iptables -A chain-times -m owner --uid-owner janek -d 127.0.0.0/8 -j ACCEPT
|
sudo iptables -A chain-times -m owner --uid-owner janek -d 127.0.0.0/8 -j ACCEPT
|
||||||
sudo iptables -A chain-times -m owner --uid-owner janek -j DROP -m time --timestart $(date -u -d "$(date -d ${1:-22})" +%k):00 --timestop $time9:00
|
sudo iptables -A chain-times -m owner --uid-owner janek -j DROP -m time --timestart $(date -u -d "$(date -d "${1:-15 min}")" +%k:%M) --timestop $time9:00
|
||||||
sudo iptables -A chain-times -m owner --uid-owner janek -j DROP -m time --weekdays 1-5 --timestart $time9:20 --timestop $(expr $time9 + 1):00
|
sudo iptables -A chain-times -m owner --uid-owner janek -j DROP -m time --weekdays 1-5 --timestart $time9:20 --timestop $(expr $time9 + 1):00
|
||||||
sudo iptables -A chain-times -m owner --uid-owner janek -j DROP -m time --weekdays 1-5 --timestart $(expr $time9 + 1):20 --timestop $(expr $time9 + 2):00
|
sudo iptables -A chain-times -m owner --uid-owner janek -j DROP -m time --weekdays 1-5 --timestart $(expr $time9 + 1):20 --timestop $(expr $time9 + 2):00
|
||||||
sudo iptables -L OUTPUT | grep -q "^chain-times" || sudo iptables -A OUTPUT -j chain-times
|
sudo iptables -L OUTPUT | grep -q "^chain-times" || sudo iptables -A OUTPUT -j chain-times
|
||||||
sudo iptables-save | sudo tee /etc/iptables.rules
|
if test "$2" = "--save"; then
|
||||||
echo "@reboot root $(which iptables-restore) < /etc/iptables.rules" | sudo tee /etc/cron.d/iptables-times
|
sudo iptables-save | sudo tee /etc/iptables/walli.rules
|
||||||
|
echo "@reboot root $(which iptables-restore) < /etc/iptables/walli.rules" | sudo tee /etc/cron.d/iptables-times
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue