This commit is contained in:
Bob Mottram 2018-02-01 15:06:55 +00:00
commit 0b00db2cd3
1 changed files with 10 additions and 1 deletions

View File

@ -77,6 +77,14 @@ function create_pleroma_blocklist {
echo "if [ ! -f /root/${PROJECT_NAME}-firewall-domains.cfg ]; then" >> $blocking_script_file
echo ' exit 0' >> $blocking_script_file
echo 'fi' >> $blocking_script_file
echo 'if [ -f /tmp/pleroma-blocking.lock ]; then' >> $blocking_script_file
echo ' cd /tmp' >> $blocking_script_file
echo ' find ./pleroma*.lock -type f -mmin +5 -exec rm {} \;' >> $blocking_script_file
echo ' if [ -f /tmp/pleroma-blocking.lock ]; then' >> $blocking_script_file
echo ' exit 0' >> $blocking_script_file
echo ' fi' >> $blocking_script_file
echo 'fi' >> $blocking_script_file
echo 'touch /tmp/pleroma-blocking.lock' >> $blocking_script_file
echo 'cd /etc/postgresql' >> $blocking_script_file
echo 'while read blocked; do' >> $blocking_script_file
echo ' if [[ "$blocked" == *"."* || "$blocked" == *"@"* ]]; then' >> $blocking_script_file
@ -89,10 +97,11 @@ function create_pleroma_blocklist {
echo ' fi' >> $blocking_script_file
echo ' fi' >> $blocking_script_file
echo "done </root/${PROJECT_NAME}-firewall-domains.cfg" >> $blocking_script_file
echo 'rm /tmp/pleroma-blocking.lock' >> $blocking_script_file
chmod +x $blocking_script_file
if ! grep -q "$blocking_script_file" /etc/crontab; then
echo "*/2 * * * * root $blocking_script_file > /dev/null" >> /etc/crontab
echo "*/1 * * * * root $blocking_script_file > /dev/null" >> /etc/crontab
fi
}