Add a lock file to the pleroma blocking script

This commit is contained in:
Bob Mottram 2018-02-01 14:47:15 +00:00
parent 1a8d9bedfb
commit 1dd303da3d
1 changed files with 5 additions and 0 deletions

View File

@ -77,6 +77,10 @@ function create_pleroma_blocklist {
echo "if [ ! -f /root/${PROJECT_NAME}-firewall-domains.cfg ]; then" >> $blocking_script_file echo "if [ ! -f /root/${PROJECT_NAME}-firewall-domains.cfg ]; then" >> $blocking_script_file
echo ' exit 0' >> $blocking_script_file echo ' exit 0' >> $blocking_script_file
echo 'fi' >> $blocking_script_file echo 'fi' >> $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 'touch /tmp/pleroma-blocking.lock' >> $blocking_script_file
echo 'cd /etc/postgresql' >> $blocking_script_file echo 'cd /etc/postgresql' >> $blocking_script_file
echo 'while read blocked; do' >> $blocking_script_file echo 'while read blocked; do' >> $blocking_script_file
echo ' if [[ "$blocked" == *"."* || "$blocked" == *"@"* ]]; then' >> $blocking_script_file echo ' if [[ "$blocked" == *"."* || "$blocked" == *"@"* ]]; then' >> $blocking_script_file
@ -89,6 +93,7 @@ function create_pleroma_blocklist {
echo ' fi' >> $blocking_script_file echo ' fi' >> $blocking_script_file
echo ' fi' >> $blocking_script_file echo ' fi' >> $blocking_script_file
echo "done </root/${PROJECT_NAME}-firewall-domains.cfg" >> $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 chmod +x $blocking_script_file
if ! grep -q "$blocking_script_file" /etc/crontab; then if ! grep -q "$blocking_script_file" /etc/crontab; then