File tree Expand file tree Collapse file tree 2 files changed +14
-16
lines changed
Expand file tree Collapse file tree 2 files changed +14
-16
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,11 @@ chmod 644 $VESTA/data/packages/$package.pkg
6969# ----------------------------------------------------------#
7070
7171# Logging
72- log_history " added user package $package " ' ' ' admin'
72+ if [ " $rewrite " != ' yes' ]; then
73+ log_history " added user package $package " ' ' ' admin'
74+ else
75+ log_history " updated user package $package " ' ' ' admin'
76+ fi
7377log_event " $OK " " $EVENT "
7478
7579exit
Original file line number Diff line number Diff line change @@ -59,25 +59,19 @@ log_event() {
5959log_history () {
6060 cmd=$1
6161 undo=${2-no}
62- log_user=" $3 "
62+ log_user=${3-$user }
63+ log=$VESTA /data/users/$log_user /history.log
6364
64- if [ -z " $log_user " ]; then
65- log_user=" $user "
65+ touch $log
66+ if [ ' 99' -lt " $( wc -l $log | cut -f 1 -d ' ' ) " ]; then
67+ tail -n 99 $log > $log .moved
68+ mv -f $log .moved $log
69+ chmod 660 $log
6670 fi
6771
68- touch $USER_DATA /history.log
69- if [ ' 99' -lt " $( wc -l $USER_DATA /history.log | cut -f 1 -d ' ' ) " ]; then
70- tail -n 99 $USER_DATA /history.log > $USER_DATA /history.log.mv
71- mv -f $USER_DATA /history.log.mv $USER_DATA /history.log
72- chmod 660 $USER_DATA /history.log
73- fi
74-
75- curr_str=$( grep " ID=" $VESTA /data/users/$log_user /history.log | \
76- cut -f 2 -d \' | sort -n | tail -n1)
72+ curr_str=$( grep " ID=" $log | cut -f 2 -d \' | sort -n | tail -n1)
7773 id=" $(( curr_str + 1 )) "
78-
79- HISTORY=" ID='$id ' DATE='$DATE ' TIME='$TIME ' CMD='$cmd ' UNDO='$undo '"
80- echo " $HISTORY " >> $VESTA /data/users/$log_user /history.log
74+ echo " ID='$id ' DATE='$DATE ' TIME='$TIME ' CMD='$cmd ' UNDO='$undo '" >> $log
8175}
8276
8377# Argument list checker
You can’t perform that action at this time.
0 commit comments