Skip to content

Commit 4d7ca9f

Browse files
change log file name and maintain its size to 1024
1 parent 472bbb1 commit 4d7ca9f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

udroid/src/proot-utils/proot-utils.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
#!/bin/bash
22

33
[[ -z $TMPDIR ]] && TMPDIR=/tmp
4-
ERROR_DUMP_FILE="$TMPDIR/proot-utils.log"
4+
ERROR_DUMP_FILE="$TMPDIR/udroid.log"
55

66
msg() { echo -e "${*} \e[0m" >&2;:;}
77
ELOG() { echo "[$(date +%F) | $(date +%R)] Error: ${*}" >> "${ERROR_DUMP_FILE}";:;}
88
LOG() { echo "[$(date +%F) | $(date +%R)] MSG:${*}" >> "${ERROR_DUMP_FILE}";:;}
99

10+
manage_log_size() {
11+
log_size=$(du -k $ERROR_DUMP_FILE | awk '{print $1}')
12+
[[ $log_size -gt 1024 ]] && rm -f $ERROR_DUMP_FILE
13+
}
14+
1015
p_extract() {
1116
# OPTIONS:
1217
# --path -> to set custom path
@@ -127,3 +132,6 @@ if [ -n "$RUN_STANDALONE" ]; then
127132
esac
128133
done
129134
fi
135+
136+
# Manage log size
137+
manage_log_size

0 commit comments

Comments
 (0)