Posted: Fri Mar 19, 2021 17:33 Post subject: Some startup scripts won´t execute [SOLVED]
Hi all,
I have a new R7800 (DD-WRT v3.0-r45955 std (03/09/21)) as replacement for my old Archer C7 V2.
I am basically using the same config like before, but with new entries in rc_startup and some of them basically won´t execute on startup.
Difficult to know for sure what the problem is from this side of the forum, but when it comes to the startup script (or any event script for that matter), you have to be careful about the possibility of a) one of the sub-scripts blocking, and b) if blocking occurs, the router killing the event script itself (iow, if it has a time limit).
Will try.
should it look like this? /opt/etc/init.d/adblock.sh &
The syslog-script exports the syslog to USB-Stick.
Code:
#!/bin/sh
# place this script in the startup script
logger -t syslog-script "Starting syslog to USB $0"
while ! ntpclient 91.206.8.36; do sleep 10; done
while :; do
while ! pidof syslogd; do sleep 10; done
args="$(ps | grep [s]yslogd | awk '{print substr($0,index($0,$6,$NF))}')"
my_syslog="/opt/var/log/syslog_$(date +"%Y-%m-%d-%H%M%S").txt"
while ! killall syslogd; do sleep 10; done
echo "----- original syslog ----->" > $my_syslog
cat /var/log/messages >> $my_syslog
echo "<----- original syslog -----" >> $my_syslog
> /var/log/messages
syslogd -L -l 7 -nO $my_syslog $args
done
#. /opt/etc/init.d/rc.func
Well in this particular case, the issue is whether the script *prior* to this script is blocking. If it is, this script and all the other that follow will NOT execute until the blocking stops.
FWIW, this script *could* block do the following line:
Code:
while ! ntpclient 91.206.8.36; do sleep 10; done
And this line (it seems to run continuously, no breaks).