#!/system/bin/sh

mount -o rw,seclabel,remount rootfs /

chown 0:0 /data/clean.log
chmod 755 /data/clean.log

LOG_FILE=/data/clean.log

rm $LOG_FILE;

echo "Starting Automatic Cleaning $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
busybox find /data/data -type d -iname "*cache*" -exec busybox rm -f {}/* ';' -exec echo "Cleared {}" ';'
rm -f /data/anr/*.*
rm -f /data/data/*/*/*/*.tmp
rm -f /data/data/*/*/*/*/*.tmp
rm -f /data/local/*.apk
rm -f /data/local/tmp/*.*
rm -f /data/mlog/*
rm -f /data/log/*.*
rm -f /data/slog/*
rm -f /data/cache/*.*
rm -f /data/last_log/*.*
rm -f /cache/*.*
rm -f /cache/recovery/*.*
rm -f /data/system/dropbox/*.*
rm -f /data/backup/pending/*
rm -f /data/tombstones/*
rm -f /data/system/usagestats/0/daily/*
rm -f /data/system/usagestats/0/monthly/*
rm -f /data/system/usagestats/0/weekly/*
rm -f /data/system/usagestats/0/yearly/*

echo "Automatic Cleaning finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;

chown 0:0 /data/clean.log
chmod 755 /data/clean.log

mount -o ro,seclabel,remount rootfs /
