diff --git a/conf/logrotate.conf b/conf/logrotate.conf new file mode 100644 index 0000000..514f203 --- /dev/null +++ b/conf/logrotate.conf @@ -0,0 +1,14 @@ +/var/log/syncthing.log { + rotate 4 + weekly + minsize 1M + missingok + create 640 root adm + notifempty + compress + delaycompress + postrotate + invoke-rc.d syncthing restart > /dev/null + endscript +} + diff --git a/scripts/install b/scripts/install index 9c8ee4d..ba75460 100644 --- a/scripts/install +++ b/scripts/install @@ -70,6 +70,12 @@ sudo update-rc.d syncthing defaults sudo yunohost service add synchting sudo service syncthing start +# Configure logrotate if present +if [ -d "/etc/logrotate.d" ]; then + sudo cp ../conf/logrotate.conf /etc/logrotate.d/syncthing + sudo chmod 0755 /etc/logrotate.d/syncthing +fi + # Configure Nginx and reload sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf sed -i "s@PORTTOCHANGE@$syncUIport@g" ../conf/nginx.conf diff --git a/scripts/remove b/scripts/remove index 2397f26..a506dde 100644 --- a/scripts/remove +++ b/scripts/remove @@ -24,6 +24,12 @@ sudo userdel $syncUser # Close port in firewall sudo yunohost firewall disallow TCP $syncSyncport +# Remove syncthing logrotate configuration +if [ -f /etc/logrotate.d/syncthing ] +then + sudo rm /etc/logrotate.d/syncthing +fi + # Remove syncthing nginx configuration domain=$(sudo yunohost app setting syncthing domain) sudo rm /etc/nginx/conf.d/$domain.d/syncthing.conf