What's new

Router up before services and entware packages are available?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

SirLoinOfSteak

Occasional Visitor
I've created a /jffs/scripts/services-start scripts to bring up some of the services I notice are not starting up. However, I noticed that the services themselves are not yet available on the filesystem itself at this point:

Code:
admin@ASUS-MERLIN-INTERNET:/jffs/scripts# ls -altri /opt/etc/init.d/S50quagga
131441 -rwxr-xr-x 1 admin root 6740 Oct 18 21:12 /opt/etc/init.d/S50quagga
admin@ASUS-MERLIN-INTERNET:/jffs/scripts#

+ /opt/etc/init.d/S50quagga start
/jffs/scripts/services-start: line 7: /opt/etc/init.d/S50quagga: not found
+ cat /etc/TZ
+ export TZ=EST5DST,M3.2.0/1,M11.1.0/1
+ awk -F= /ntp_server0/{ print $2 }
+ nvram show
+ NTP0=192.168.0.46
+ ntpdate 192.168.0.46
/jffs/scripts/services-start: line 11: ntpdate: not found
+ date

After SSH is up and I can login, I can see these commands are there:

Code:
admin@ASUS-MERLIN-INTERNET:/jffs/scripts# ls -altri /opt/etc/init.d/S50quagga
131441 -rwxr-xr-x 1 admin root 6740 Oct 18 21:12 /opt/etc/init.d/S50quagga
admin@ASUS-MERLIN-INTERNET:/jffs/scripts# which ntpdate
/opt/sbin/ntpdate
admin@ASUS-MERLIN-INTERNET:/jffs/scripts#

Which scripts could I use to ensure these commands are available when I execute them? Thinking of just looping through looking for these files within services-start.

Thx,
 
Seems like a problem with your entware installation. Usually there'd be an entry in /jffs/scripts/post-mount which would call /opt/etc/init.d/rc.unslung start "$0" when the drive is mounted, and that'd load all the enabled /opt/etc/init.d/S## scripts.
 
Hmm. You're correct about that:

Code:
admin@ASUS-MERLIN-INTERNET:/tmp/home/root# cat /jffs/scripts/post-mount
#!/bin/sh
. /jffs/addons/diversion/mount-entware.div # Added by amtm
admin@ASUS-MERLIN-INTERNET:/tmp/home/root#

However, those startup scripts become available eventually. For the time being, I've added a loop in the services-start script to loop on and wait for the executables to be available. This works since services-start is non-blocking.

Code:
cat /jffs/scripts/services-start
.
.
.
# Loop through looking for specific commands before executing here.
iter=12
counter=0
while true; do
        if [ ! -r /opt/etc/init.d/S50quagga ] && [ $( which ntpdate )"x" == "x" ] && [ $counter -lt $iter ]; then
                echo "/opt/etc/init.d/S50quagga and ntpdate are not yet available. Sleeping for 5 seconds.";
                sleep 5;
                counter=$((counter+1))
        else
                break
        fi
done

.
.
.

It's almost as if Entware is reinstalling all the packages on boot.
 
It's almost as if Entware is reinstalling all the packages on boot.
The link to /opt won’t be created until the USB is mounted and rc.unslung is run (or the Diversion entware script if installed that way). So the path to the Entware apps is invisible until then.
 
That makes sense with what I see happening.

Given this, do you both think what I'm doing with the for loop makes sense or should I be tossing the startup logic in another file under /jffs/scripts/ ?
 
That makes sense with what I see happening.

Given this, do you both think what I'm doing with the for loop makes sense or should I be tossing the startup logic in another file under /jffs/scripts/ ?
post-mount is the correct place to start Entware which will start all the S scripts in /opt/etc/init.d. Forcing the issue in services-start doesn’t make sense to me. Is there a particular app you are concerned about starting first?
 
Just need OSPF / Quagga and ntpdate available. NTP date won't run if the router is not internet facing and connected using the WAN port. I'll toss the code into post-mount and see how that works out.
 

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top