Clear down GS/pA posts daily

This commit is contained in:
Bob Mottram 2017-08-10 13:32:02 +01:00
parent c15772bd21
commit b5b84a7127
1 changed files with 5 additions and 4 deletions

View File

@ -791,15 +791,16 @@ function expire_gnusocial_posts {
echo '$rowaff1 notices, $rowaff2 conversations, $rowaff3 replies, and $rowaff4 qvitter notifications deleted from database.\n";' >> $gnusocial_expire_posts_script
chmod +x $gnusocial_expire_posts_script
gnusocial_expire_script=/usr/bin/${gnusocial_type}-expire
gnusocial_expire_script=/etc/cron.daily/${gnusocial_type}-expire
echo '#!/bin/bash' > $gnusocial_expire_script
echo "find /var/www/${domain_name}/htdocs/file/* -mtime +${expire_days_files} -exec rm {} +" >> $gnusocial_expire_script
echo "/usr/bin/php $gnusocial_expire_posts_script" >> $gnusocial_expire_script
chmod +x $gnusocial_expire_script
# Add a cron job
if ! grep -q "${gnusocial_expire_script}" /etc/crontab; then
echo "10 3 5 * * root /usr/bin/timeout 500 ${gnusocial_expire_script}" >> /etc/crontab
# remove any old cron job
if grep -q "${gnusocial_type}-expire" /etc/crontab; then
sed -i "/${gnusocial_type}-expire/d" /etc/crontab
rm /usr/bin/${gnusocial_type}-expire
fi
# remove old expire script