From 23a4bb9209698e3bdabbbb22dc2621451f7e37ca Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Sat, 31 Jan 2026 23:27:19 -0800 Subject: [PATCH] Code Improvements More code improvements. --- README.md | 2 +- init.d/rc.func.syslog-ng | 4 ++-- scribe.sh | 25 +++++++++++++------------ syslog-ng.share/syslog-ng.conf-scribe | 18 ++++++++++-------- 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index e45e460..a98416c 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **scribe** is a **syslog-ng** and **logrotate** installer for ASUS routers running **Asuswrt-Merlin** ## v3.2.9 -### Updated on 2026-Jan-30 +### Updated on 2026-Jan-31 ## Getting Started diff --git a/init.d/rc.func.syslog-ng b/init.d/rc.func.syslog-ng index 50a005d..54f977e 100644 --- a/init.d/rc.func.syslog-ng +++ b/init.d/rc.func.syslog-ng @@ -1,7 +1,7 @@ #!/bin/sh - # # NB: rc.func only runs PRECMD on "start" -# Last Modified: 2026-Jan-27 +# Last Modified: 2026-Jan-31 # VERSION="3.1.5" #------------------------------------------- @@ -44,7 +44,7 @@ kill_logger() if [ ! -f "$syslogNG_StartSEM_FPath" ] then $loggerCmd -t "$logTagStr" $logPrioNum "Calling Scribe SysLogNgStartDelay..." - echo "150" > "$syslogNG_WaitnSEM_FPath" + [ ! -f "$syslogNG_WaitnSEM_FPath" ] && echo "150" > "$syslogNG_WaitnSEM_FPath" nohup "$scribeScriptFPath" SysLogNgStartDelay >/dev/null 2>&1 & exit 1 fi diff --git a/scribe.sh b/scribe.sh index 860a9ed..e47379e 100644 --- a/scribe.sh +++ b/scribe.sh @@ -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-Jan-30 +# Last Modified: 2026-Jan-31 #----------------------------------------------------------------- ################ Shellcheck directives ################ @@ -35,7 +35,7 @@ readonly script_name="scribe" readonly scribe_ver="v3.2.9" -readonly scriptVer_TAG="26013023" +readonly scriptVer_TAG="26013123" scribe_branch="develop" script_branch="$scribe_branch" @@ -1817,7 +1817,7 @@ Menu_Restart() printf "\n ${white}%s ${red}NOT${white} running! ${yellow}Starting...${std}\n" "$sng" $S01sng_init start fi - sleep 1 #Allow time to start up# + sleep 2 #Allow time to start up# Restart_uiScribe } @@ -2117,7 +2117,7 @@ Update_Version() menu_forgrnd() { - restrt=false + local doStart=false if SyslogNg_Running then warning_sign @@ -2126,20 +2126,20 @@ menu_forgrnd() printf " Debugging mode is intended for troubleshooting when\n" printf " %s will not start.\n\n" "$sng" printf " Are you certain you wish to start debugging mode [y|n]? $std" - if ! Yes_Or_No; then return; fi - restrt=true + if ! Yes_Or_No; then return 1; fi + doStart=true fi printf "\n$yellow NOTE: If there are no errors, debugging mode will\n" printf " continue indefinitely. If this happens, type\n" printf " to halt debugging mode output.\n\n" PressEnterTo "start:" - if "$restrt" + if "$doStart" then $S01sng_init stop; echo fi trap '' 2 $sng_loc -Fevd trap - 2 - if "$restrt" + if "$doStart" then echo ; $S01sng_init start fi echo @@ -2980,13 +2980,16 @@ case "$action" in then Menu_Restart Menu_Status + cliParamCheck=false fi ;; #Stop syslog-ng & logrotate Cron Job# stop) if SyslogNg_Running || "$usbUnmountCaller" - then Menu_Stop + then + Menu_Stop + cliParamCheck=false fi ;; @@ -3077,9 +3080,7 @@ esac if ! "$scribeInstalled" && "$cliParamCheck" then printf "\n${yellow} %s ${white}is NOT installed, command \"%s\" not valid!${std}\n\n" "$script_name" "$action" -elif ! SyslogNg_Running && \ - "$cliParamCheck" && \ - [ "$action" != "stop" ] +elif ! SyslogNg_Running && "$cliParamCheck" then printf "\n${yellow} %s ${white}is NOT running, command \"%s\" not valid!${std}\n\n" "$sng" "$action" else diff --git a/syslog-ng.share/syslog-ng.conf-scribe b/syslog-ng.share/syslog-ng.conf-scribe index 2dfe320..69de93c 100644 --- a/syslog-ng.share/syslog-ng.conf-scribe +++ b/syslog-ng.share/syslog-ng.conf-scribe @@ -35,24 +35,26 @@ source src { recursive(no) max-files(1) follow_freq(1) log_iw_size(1200) log_fetch_limit(1000) flags(syslog-protocol)); internal(); -# uncomment this line to pass all network messages through syslog-ng filters # -#OFF# udp(ip(192.168.x.y) port(514)); +# uncomment the line below to pass ALL network log messages through syslog-ng filters # +#OFF# udp(port(514) flags(syslog-protocol)); }; # if you only want to pass network messages through some syslog-ng filters, uncomment the source line below -# then add "source(net);" to the log statement in any filter you want to pass network messages through -#OFF# source net { udp(ip(192.168.x.y) port(514)); }; +# then add "source(s_net);" to the log statement in any filter you want to pass network messages through +#OFF# source s_net { udp(port(514) flags(syslog-protocol)); }; -# set the filename for the default log file - anything not filtered out will end up here +# set the filename for the default log file - anything not filtered out will end up here # destination messages { file("/opt/var/log/messages"); }; -# to send log messages to the local network, uncomment the destination line below +# to send log messages to the local network, uncomment the destination line below # # then add "destination(log_server);" to the log statement in any filter you want to pass network messages through #OFF# destination log_server { udp("192.168.x.y" port(514)); }; log { source(src); -#OFF# source(net); # uncomment this and "source net" function above to get udp log messages from local network +# uncomment this and "source s_net" function above to get udp log messages from local network # +#OFF# source(s_net); destination(messages); -#OFF# destination(log_server); # uncomment this and "destination log_server" function above to send udp log messages to local network +# uncomment this and "destination log_server" function above to send udp log messages to local network # +#OFF# destination(log_server); };