What's new

"services-start" starts too early or I put the file at wrong file?

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

chncar

Occasional Visitor
I’m now using RT-AC68U with Merlin LTS fork 34E3j9527. And the DNS over LTS enabled.


I added bellowed command in services-start to connect IP address and the MAC.


Arp -s 192.168.x.x AA:BB:CC:DD:DE


It doesn’t work. The file is executed but nothing happened, IP is not connected with the MAC


I added 25s delay in the file and it works.


According to merlin wiki, the file services-start shall be executed after all system services.


Is this a bug or I put the command in wrong file?
 
I don't know whether the wiki for @RMerlin's build is fully applicable on @john9527's LTS fork. Did you try the helpful hint at the end of the wiki page to check? If you add a logger line you can also check syslog.
 
I’m now using RT-AC68U with Merlin LTS fork 34E3j9527. And the DNS over LTS enabled.


I added bellowed command in services-start to connect IP address and the MAC.


Arp -s 192.168.x.x AA:BB:CC:DD:DE


It doesn’t work. The file is executed but nothing happened, IP is not connected with the MAC


I added 25s delay in the file and it works.


According to merlin wiki, the file services-start shall be executed after all system services.


Is this a bug or I put the command in wrong file?
Make sure script is executable. If not, type chmod 755 services-start

First line must be a shebang: #!/bin/sh

The arp command should be all lower case. Try running the services-start from the command line to see if it works without errors e.g. sh services.start

@M@rco has a good suggestion to add a system log entry at the script start and script end.

logger -t "($(basename "$0"))" $$ "Script Starting"

logger -t "($(basename "$0"))" $$ "Script Ending"
 
Services-start runs fairly early, and starts a group of services, but not all of them. Quite a few services are tied to events rather than started by this section of the code.
 
I don't know whether the wiki for @RMerlin's build is fully applicable on @john9527's LTS fork.
Should be the same on my fork. Not sure it's applicable in this case, but in the 'early' running scripts, init-start and services-start, you should always include the path in the command as the environment may not be fully set yet...i.e. /sbin/arp

Also, it's arp, not Arp (case matters in linux)
 
Thanks for all your replies.

Actually my services-start file contains command "arp -s IP MAC" now works fine. I just feel strange why I have to put 25s before the command to make it work.

I tried full set command format like "/sbin/arp -s IP MAC" , but I still need to add delays before that command to make it work.

I think Rmerlin is correct that services-start runs after most of system services but not all of them.
 
Might be because the interface hasn't been brought up yet. I have a script that changes the cwnd that, when executed without a sleep command, will fail because of that. So you might have the inject the 25s sleep command right before your command to give it time for the router to bring up that interface.
 

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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