petits-scripts-persos/startsync
2025-06-06 00:14:54 +02:00

27 lines
998 B
Bash
Executable File

#!/bin/bash
#feedreader &>/dev/null &
#jami-gnome &>/dev/null &
#nicotine &>/dev/null &
#qbittorrent &>/dev/null &
#vdirsyncer sync
if [ "$(host -t a wg.rezine.org 9.9.9.9 2>/dev/null | grep -o ' has address .*')" != "$(host -t a wg.rezine.org 2>/dev/null | grep -o ' has address .*')" ] ; then
echo "-------------------------"
echo ""
echo "wg.rezine.org seems to have changed, you mail need to update your /etc/dnsmasq.conf"
notify-send "Consistency check" "wg.rezine.org seems to have changed, you mail need to update your /etc/dnsmasq.conf"
echo ""
echo "-------------------------"
sleep 3
fi
sudo -u emails bash <<EOF
if [ -n "\$(find ~/.mails/collected_addresses.txt -mtime +24)" ] ; then
echo 'Rebuild mail addressbook'
(notmuch address --output sender '*' ; notmuch address --output recipients '*') | grep -vP "<.*[\x00-\x1F\x7F-\xFF].*>" | grep -vP "[\x00-\x1F\x7F-\xFF]\S*@" | grep -vP "@\S*[\x00-\x1F\x7F-\xFF]" | sort -u > ~/.mails/collected_addresses.txt
fi
syncmails
EOF