1.Default retention time
2.Check Logrotate after Check User

https://github.com/XTLS/Xray-core/discussions/2369#discussioncomment-6554217
This commit is contained in:
KoinuDayo 2023-07-27 03:06:09 +08:00
parent 4847b9d999
commit 515eace59b
1 changed files with 6 additions and 14 deletions

View File

@ -626,7 +626,6 @@ stop_xray() {
install_with_logrotate() {
install_software 'logrotate' 'logrotate'
check_install_user
if [[ -z "$LOGROTATE_TIME" ]]; then
LOGROTATE_TIME="00:00:00"
fi
@ -655,20 +654,10 @@ EOF
LOGROTATE_DIR='1'
fi
cat << EOF > /etc/logrotate.d/xray
/var/log/xray/access.log {
/var/log/xray/*.log {
daily
missingok
rotate 30
compress
delaycompress
notifempty
create 0600 $INSTALL_USER_UID $INSTALL_USER_GID
}
/var/log/xray/error.log {
daily
missingok
rotate 30
rotate 7
compress
delaycompress
notifempty
@ -824,10 +813,13 @@ main() {
[[ "$CHECK" -eq '1' ]] && check_update
[[ "$REMOVE" -eq '1' ]] && remove_xray
[[ "$INSTALL_GEODATA" -eq '1' ]] && install_geodata
[[ "$LOGROTATE" -eq '1' ]] && install_with_logrotate
# Check if the user is effective
check_install_user
# Check Logrotate after Check User
[[ "$LOGROTATE" -eq '1' ]] && install_with_logrotate
# Two very important variables
TMP_DIRECTORY="$(mktemp -d)"
ZIP_FILE="${TMP_DIRECTORY}/Xray-linux-$MACHINE.zip"