File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -128,20 +128,19 @@ log_history() {
128128 fi
129129 touch $log
130130
131- # TODO: Improve log pruning and pagination
132- #
133- # if [ '1000' -lt "$(wc -l $log |cut -f 1 -d ' ')" ]; then
134- # tail -n 499 $log > $log.moved
135- # mv -f $log.moved $log
136- # chmod 660 $log
137- # fi
131+ if [ ' 750' -lt " $( wc -l $log | cut -f 1 -d ' ' ) " ]; then
132+ tail -n 499 $log > $log .moved
133+ mv -f $log .moved $log
134+ chmod 660 $log
135+ fi
138136
139137 if [ -z " $date " ]; then
140138 time_n_date=$( date +' %T %F' )
141139 time=$( echo " $time_n_date " | cut -f 1 -d \ )
142140 date=$( echo " $time_n_date " | cut -f 2 -d \ )
143141 fi
144- curr_str=$( grep " ID=" $log | cut -f 2 -d \' | sort -n | tail -n1)
142+
143+ curr_str=$( tail -n1 $log | grep " ID=" --text | cut -f2 -d \' )
145144 id=" $(( curr_str + 1 )) "
146145 echo " ID='$id ' DATE='$date ' TIME='$time ' LEVEL='$evt_level ' CATEGORY='$evt_category ' MESSAGE='$message '" >> $log
147146}
You can’t perform that action at this time.
0 commit comments