Add a lock file to the pleroma blocking script
This commit is contained in:
parent
1a8d9bedfb
commit
1dd303da3d
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue