diff --git a/MANIFEST.in b/MANIFEST.in index 7e707c6..9642293 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -12,5 +12,6 @@ include scripts/bbctrl.service include scripts/11-automount.rules include scripts/resize_root_fs.sh include scripts/resize2fs_once +include scripts/bbctrl-logrotate recursive-include src/py/camotics * global-exclude .gitignore diff --git a/scripts/bbctrl-logrotate b/scripts/bbctrl-logrotate new file mode 100644 index 0000000..906336d --- /dev/null +++ b/scripts/bbctrl-logrotate @@ -0,0 +1,8 @@ +/var/log/bbctrl.log { + rotate 4 + weekly + compress + missingok + notifempty + copytruncate +} diff --git a/scripts/install.sh b/scripts/install.sh index 36b69f4..3bdeb2a 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -142,6 +142,40 @@ if [ $? -eq 0 ]; then REBOOT=true fi +# Install our logrotate config +cp ./scripts/bbctrl-logrotate /etc/logrotate.d/bbctrl +chown root:root /etc/logrotate.d/bbctrl + +########################################## +# Begin one-time cleanup tasks for 1.0.7 +########################################## + +# Delete the entire local Chromium configuration. Start clean. +rm -rf /home/pi/.config/chromium + +# Get rid of some old files that were left behind +rm -rf /home/pi/hostinfo.txt +rm -rf /home/pi/ssidinfo.txt +rm -rf /home/bbmc/bbctrl-1.0.0.tar.bz2 +rm -rf /home/bbmc/hostinfo.sh +rm -rf /home/bbmc/index.html +rm -rf /home/bbmc/favicon.ico + +# Force a logrotate to get everything into a known state +logrotate -f /etc/logrotate.conf + +# Clean up the log directory - get rid of everything old +rm -rf /var/log/*.gz +rm -rf /var/log/*.1 +rm -rf /var/log/*.old +rm -rf /var/log/bbctrl.2019*.install +rm -rf /var/log/bbctrl.2020*.install +rm -rf /var/log/bbctrl.log.* + +########################################## +# End one-time cleanup tasks for 1.0.7 +########################################## + sync if $REBOOT; then diff --git a/src/py/bbctrl/Log.py b/src/py/bbctrl/Log.py index 0436375..6e1226f 100644 --- a/src/py/bbctrl/Log.py +++ b/src/py/bbctrl/Log.py @@ -170,7 +170,7 @@ class Log(object): if self.path is None: return if self.f is not None: self.f.close() self._rotate(self.path) - self.f = open(self.path, 'w') + self.f = open(self.path, 'a') self.bytes_written = 0