What's new

adding script to services-start

  • 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!

GoNz0

Very Senior Member
I am just about getting my head around jffs and scripts but this is not my area at all!

I thought I had done well sorting the led on and off scripts so i took the plunge and went head 1st into Improve Your Web Surfing Speed with OpenDNS

and it worked!


but.

it did its own services-start

Code:
#!/bin/sh

sleep 10
/opt/etc/init.d/rc.unslung start

replacing

Code:
#!/bin/sh
cru a lightsoff "0 22 * * * /jffs/scripts/ledsoff.sh"
cru a lightson "0 7 * * * /jffs/scripts/ledson.sh"


if i try and add the above into the new file it breaks everything, no lights and when I visit http://www.opendns.com/welcome/ it tells me I am not using opendns.

Would one of you scripters mind giving me a copy and paste that works please :)

(oh and i didn't put #!/bin/sh in twice)
 
Last edited:
crap, it works for a few minutes then stops..

and that is just using.

Code:
#!/bin/sh

sleep 10
/opt/etc/init.d/rc.unslung start

(seems to be the laptops dns service causing the problem as disabling it leaves opensdns saying yes)
 
Last edited:
Can't help you with the opendns stuff, but personally, I run the entware setup stuff in post-mount, not in services-start. Services-start runs too early: the entware drive may not be mounted yet, forcing you to do this "sleep 10" or some other delay.

My post-mount is basically
Code:
#!/bin/sh

if [ $1 = "/tmp/mnt/sda1" ]
then
  # Entware setup
  ln -sf $1/entware /tmp/opt

  # Entware services. Do NOT use services-start for this: services-start is executed before post-mount!
  if [ -x /opt/etc/init.d/rc.unslung ]
  then
    /usr/bin/logger -t $0 "Found rc.unslung; starting entware services"
    /opt/etc/init.d/rc.unslung start
    /usr/bin/logger -t $0 "Entware services started"
  else
    /usr/bin/logger -t $0 "ERROR: rc.unslung not found; entware services NOT STARTED"
  fi

fi

/tmp/mnt/sda1 is my internal microSD card. Adapt to wherever your entware is. The check whether rc.unslung exists at all is just there to catch mount problems; I had it happen once (and then never again) that the microSD card got wiped at or after a power failure.
 
Thanks, I did your script changes and it still seems to be starting up ok.

Odd thing is it still starts and resolves correct for http://www.opendns.com/welcome/ then a few minutes later packs in?

I put an old 8gb micro SD in to do it as I forgot it had that hidden away, it has to be a hell of a lot faster than a USB2 device!

Code:
#!/bin/sh

if [ $1 = "/tmp/mnt/Internal_8GB" ]
then
  # Entware setup
  ln -sf $1/entware /tmp/opt

  # Entware services. Do NOT use services-start for this: services-start is executed before post-mount!
  if [ -x /opt/etc/init.d/rc.unslung ]
  then
    /usr/bin/logger -t $0 "Found rc.unslung; starting entware services"
    /opt/etc/init.d/rc.unslung start
    /usr/bin/logger -t $0 "Entware services started"
  else
    /usr/bin/logger -t $0 "ERROR: rc.unslung not found; entware services NOT STARTED"
  fi

fi
 
Odd thing is it still starts and resolves correct for http://www.opendns.com/welcome/ then a few minutes later packs in?

Using post-mount to start entware things wouldn't solve your OpenDNS problem. It just disentangles entware services from other services and ensures entware things are accesssed only once the entware drive has indeed been mounted.

Can't help you with the opendns stuff, [...]
Never tried OpenDNS/dnscrypt myself before, so I wouldn't have any idea what might be going on.
 
seems to be making the right noises in the logs, only my mobile phone can get the correct responce from opendns.com/welcome.

I will open a new thread for opendns.

Thanks for the script change to do the post mount :)
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

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