mirror of
https://yerbamate.ml/nutomic/peertube.social
synced 2024-11-25 00:08:20 -05:00
Add script for email announcements
This commit is contained in:
parent
a0528dc1af
commit
2a244ee167
4
files/email-template.txt
Normal file
4
files/email-template.txt
Normal file
@ -0,0 +1,4 @@
|
||||
subject:email to all users
|
||||
from:info@your-instance.com
|
||||
|
||||
this is a test email.
|
27
files/send-email-to-users.bash
Normal file
27
files/send-email-to-users.bash
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo -e "This will send an email to all users, based on the template in $(pwd)/email-template.txt. Content:\n\n"
|
||||
cat email-template.txt
|
||||
echo -e "\n\n"
|
||||
|
||||
read -p "Send test email (y/N)? " SEND_EMAIL
|
||||
case "$SEND_EMAIL" in
|
||||
[yY]* ) ;;
|
||||
[nN]* ) exit;;
|
||||
* ) exit;;
|
||||
esac
|
||||
|
||||
EMAIL_LIST=$(mktemp)
|
||||
echo $EMAIL_LIST
|
||||
docker-compose exec -T -u postgres postgres psql -U peertube -d peertube -c "SELECT email FROM public.user WHERE NOT blocked" -t > $EMAIL_LIST
|
||||
echo "Sending email to $(wc -l $EMAIL_LIST | cut -d' ' -f1) users"
|
||||
|
||||
cat $EMAIL_LIST | while read EMAIL
|
||||
do
|
||||
echo "sending to $EMAIL"
|
||||
cat email-template.txt | \
|
||||
docker exec -i "$(docker-compose ps -q postfix)" sendmail -t "$EMAIL"
|
||||
done
|
||||
|
||||
rm $EMAIL_LIST
|
10
peertube.yml
10
peertube.yml
@ -25,11 +25,13 @@
|
||||
- { path: '/peertube/volumes/certbot/' }
|
||||
- { path: '/peertube/volumes/config/' }
|
||||
|
||||
- name: copy docker config
|
||||
copy: src={{item.src}} dest={{item.dest}} mode='0644'
|
||||
- name: copy files
|
||||
copy: src={{item.src}} dest={{item.dest}} mode={{item.mode}} force={{item.force}}
|
||||
with_items:
|
||||
- { src: 'files/docker-daemon.json', dest: '/etc/docker/daemon.json' }
|
||||
- { src: 'files/local-production.json', dest: '/peertube/volumes/config/local-production.json' }
|
||||
- { src: 'files/docker-daemon.json', dest: '/etc/docker/daemon.json', mode: '0644', force: 'yes' }
|
||||
- { src: 'files/local-production.json', dest: '/peertube/volumes/config/local-production.json', mode: '0644', force: 'yes' }
|
||||
- { src: 'files/send-email-to-users.bash', dest: '/peertube/send-email-to-users.bash', mode: '755', force: 'yes' }
|
||||
- { src: 'files/email-template.txt', dest: '/peertube/email-template.txt', mode: '0644', force: 'no' }
|
||||
|
||||
- name: get latest peertube version from github
|
||||
uri:
|
||||
|
Loading…
Reference in New Issue
Block a user