--- /dev/null
+[Unit]
+Description=microblog.pub pruning
+
+[Service]
+Type=simple
+ExecStart=/bin/sh -c '.prune.sh'
+
+[Install]
+WantedBy=multi-user.target
--- /dev/null
+[Unit]
+Description=schedule microblog.pub pruning
+
+[Timer]
+Unit=reboot.service
+OnCalendar=*-*-* 7:00:00
+
+[Install]
+WantedBy=timers.target
--- /dev/null
+#!/bin/sh
+set -e
+set -x
+service microblogpub stop
+microblogdir=/home/plom/testing.microblog.pub
+cd "${microblogdir}"
+cp -r data/microblogpub.db data/microblogpub.db.bak.$(date +%a)
+su -lc "cd ${microblogdir} && poetry run inv prune-old-data" - plom
+service microblogpub start
+echo "last microblog pruning at $(date)" >> /home/plom/prune_log.txt
sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/nginx/sites-available/microblogpub.nginx
ln -s /etc/nginx/sites-available/microblogpub.nginx /etc/nginx/sites-enabled/microblogpub.nginx
service nginx restart
+
+# Setup regular DB pruning
+cp "${config_tree_prefix}/other_files/prune_microblog.sh" /home/plom/
+systemctl enable microblogpub_prune.timer
+systemctl start microblogpub_prune.timer