From b5b84a712797b91b8be2d2298c8fe15e8e8b6baa Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 10 Aug 2017 13:32:02 +0100 Subject: [PATCH] Clear down GS/pA posts daily --- src/freedombone-utils-gnusocialtools | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/freedombone-utils-gnusocialtools b/src/freedombone-utils-gnusocialtools index ea01839e..758c3129 100755 --- a/src/freedombone-utils-gnusocialtools +++ b/src/freedombone-utils-gnusocialtools @@ -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