Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**scribe** is a **syslog-ng** and **logrotate** installer for ASUS routers running **Asuswrt-Merlin**

## v3.2.13
### Updated on 2026-Aug-16
### Updated on 2026-Sep-08

## Getting Started

Expand Down
23 changes: 12 additions & 11 deletions init.d/rc.func.syslog-ng
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh -
#
# NB: rc.func only runs PRECMD on "start"
# Last Modified: 2026-Apr-09
# VERSION="3.1.6"
# Last Modified: 2026-Sep-08
# VERSION="3.1.7"
#-------------------------------------------

## Run the F/W built-in native commands ##
Expand All @@ -21,10 +21,11 @@ logTagStr="scribe:kill_logger[$$]"
logPrioNum="-p 4"

##----------------------------------------##
## Modified by Martinski W. [2026-Apr-09] ##
## Modified by Martinski W. [2026-Sep-08] ##
##----------------------------------------##
kill_logger()
{
local varLibDIR lrStatusFILE
local serviceCallOK prevSysLog_Loc messagesLogSAVED
local scribeScriptFPath="/jffs/scripts/scribe"
local booleanStr=false filterSyslogInitRebootLogMsgs=true
Expand Down Expand Up @@ -100,14 +101,14 @@ kill_logger()

[ "$syslog_loc" = "$jffslog" ] && isjffs=true

# Touch 'logrotate.status' if it doesn't exist so syslog-ng doesn't whine #
[ ! -f /var/lib/logrotate.status ] && touch /var/lib/logrotate.status

##----------------------------------------##
## Modified by Martinski W. [2025-Jun-16] ##
##----------------------------------------##
# Set correct permissions to avoid "world-readable" status #
chmod 600 /var/lib/logrotate.status
[ ! -d /opt/var/lib ] && mkdir -p -m 755 /opt/var/lib
for varLibDIR in /var/lib /opt/var/lib
do
lrStatusFILE="${varLibDIR}/logrotate.status"
[ ! -f "$lrStatusFILE" ] && touch "$lrStatusFILE"
# Set correct permissions to avoid "world-readable" status #
chmod 600 "$lrStatusFILE"
done

# Export timezone if not already set #
[ -z "${TZ:+xSETx}" ] && export TZ="$($catCmd /etc/TZ)"
Expand Down
46 changes: 33 additions & 13 deletions scribe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# curl --retry 3 "https://raw.githubusercontent.com/AMTM-OSR/scribe/master/scribe.h" -o "/jffs/scripts/scribe" && chmod 0755 /jffs/scripts/scribe && /jffs/scripts/scribe install
#
##################################################################
# Last Modified: 2026-Aug-16
# Last Modified: 2026-Sep-08
#-----------------------------------------------------------------

################ Shellcheck directives ################
Expand All @@ -37,7 +37,7 @@

readonly script_name="scribe"
readonly scribe_ver="v3.2.13"
readonly scriptVer_TAG="26081609"
readonly scriptVer_TAG="26090820"
scribe_branch="develop"
script_branch="$scribe_branch"

Expand Down Expand Up @@ -547,6 +547,22 @@ Create_Config()
# Assume uiScribe is still running if it was before stopping syslog-ng #
}

##-------------------------------------##
## Added by Martinski W. [2026-Sep-08] ##
##-------------------------------------##
_Check_LogRotate_StatusFile_()
{
local varLibDIR lrStatusFILE
[ ! -d /opt/var/lib ] && mkdir -p -m 755 /opt/var/lib
for varLibDIR in /var/lib /opt/var/lib
do
lrStatusFILE="${varLibDIR}/logrotate.status"
[ ! -f "$lrStatusFILE" ] && touch "$lrStatusFILE"
# Set correct permissions to avoid "world-readable" status #
chmod 600 "$lrStatusFILE"
done
}

##----------------------------------------##
## Modified by Martinski W. [2026-Jan-30] ##
##----------------------------------------##
Expand All @@ -572,12 +588,7 @@ Read_Config()
then
_Config_Option_Update_ FILTER_INIT_REBOOT_LOG true
fi

# Set correct permissions to avoid "world-readable" status #
if [ "$action" != "debug" ] && \
[ -f /var/lib/logrotate.status ]
then chmod 600 /var/lib/logrotate.status
fi
[ "$action" != "debug" ] && _Check_LogRotate_StatusFile_
}

##----------------------------------------##
Expand Down Expand Up @@ -1002,8 +1013,7 @@ LogRotate_CronJob_PostMount_Check()
else
present
fi
# Set correct permissions to avoid "world-readable" status #
[ -f /var/lib/logrotate.status ] && chmod 600 /var/lib/logrotate.status
_Check_LogRotate_StatusFile_
}

##----------------------------------------##
Expand Down Expand Up @@ -1562,13 +1572,16 @@ _AcquireFLock_()
if [ $# -gt 0 ] && [ "$1" = "waitblock" ]
then opts=""
fi
eval exec "$LR_FLock_FD>$LR_FLock_FName"
eval exec "${LR_FLock_FD}>$LR_FLock_FName"
flock -x $opts "$LR_FLock_FD" 2>/dev/null
return "$?"
}

_ReleaseFLock_()
{ flock -u "$LR_FLock_FD" 2>/dev/null ; }
{
flock -u "$LR_FLock_FD" 2>/dev/null
eval exec "${LR_FLock_FD}>&-"
}

##-------------------------------------##
## Added by Martinski W. [2026-Jan-04] ##
Expand Down Expand Up @@ -2458,7 +2471,14 @@ Gather_Debug()
printf "\n%s\n### init.d directory:\n" "$debug_sep"
ls -l /opt/etc/init.d
printf "\n%s\n### check logrotate.status \n" "$debug_sep"
ls -l /var/lib/logrotate.status
for varLibDIR in /var/lib /opt/var/lib
do
lrStatusFILE="${varLibDIR}/logrotate.status"
if [ -f "$lrStatusFILE" ]
then ls -lL "$lrStatusFILE"
else printf "*WARNING*: Status file '$lrStatusFILE' is NOT found.\n"
fi
done
printf "\n%s\n### contents of S01syslog-ng\n" "$debug_sep"
cat /opt/etc/init.d/S01syslog-ng
printf "\n%s\n### /opt/var/log directory:\n" "$debug_sep"
Expand Down