Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions bin/oref0-cron-every-minute.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,17 @@ if [[ ! -z "$PUSHOVER_TOKEN" && ! -z "$PUSHOVER_USER" ]]; then
oref0-pushover $PUSHOVER_TOKEN $PUSHOVER_USER 2>&1 >> /var/log/openaps/pushover.log &
fi

# if disk has less than 10MB free, delete something and logrotate
cd /var/log/openaps/ && df . | awk '($4 < 10000) {print $4}' | while read line; do
# find the oldest log file
ls -t | tail -1
done | while read file; do
# delete the oldest log file
rm $file
# attempt a logrotate
logrotate /etc/logrotate.conf -f
done

# check if 5 minutes have passed, and if yes, turn of the screen to save power
ttyport="$(get_pref_string .ttyport)"
upSeconds="$(cat /proc/uptime | grep -o '^[0-9]\+')"
Expand Down