#!/bin/sh if [ ! -e /var/lib/lowmem ]; then exit 0 fi for log in syslog messages; do logpath=/var/log/$log [ -s $logpath ] && echo "Log file truncated to save memory." > $logpath # using % in place of / allows us to look for a pattern containing /'s # the [t] stops sed's ps listing from matching it's own pattern pid=$(ps ax | sed -n 's%^[ ]*\([0-9]*\).*[t]ail -f '$logpath'.*%\1%p') if [ -n "$pid" ]; then kill $pid || true fi done rm -rf /usr/share/keymaps \ /usr/share/console-setup-mini/*.ekmap* \ /usr/share/console-setup-mini/*.ekbd* \ /usr/share/console-setup/*.ekmap* \ /usr/share/console-setup/*.ekbd* \ /usr/share/console-setup/keyboard-configuration.config \ /usr/share/consolefonts