What's new

Custom scripts dont start when reboot the router

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

Make sure the filename is all lower-case, and that services-start is plural.
 
I use always lower case.
This weekend i put you firmare back again.
 
hello to everybody thank for our help.

I review the config again and services-start is plural and the file name is lowercase and i have dash no underscore....

I do something wrong or this version have a bug .. i don't know.

Any suggestion ?

thanks

Roman
 
hello to everybody thank for our help.

I review the config again and services-start is plural and the file name is lowercase and i have dash no underscore....

I do something wrong or this version have a bug .. i don't know.

Any suggestion ?

thanks

Roman

Hi
Very strange, maby you can upload files to pastebin.com and share links, then we may discover your problem.

on your /jffs/scripts/ it looks like this?
j7Jw08V.jpg
 
Last edited:
Hi
Very strange, maby you can upload files to pastebin.com and share links, then we may discover your problem.

on your /jffs/scripts/ it looks like this?
j7Jw08V.jpg

Folks,

I have the same issue as Roman. Maybe can add some info to help the experts here debug this?

In my case it is a very simple two line script in services-start to add some routing rule.

The file was chmoded to 777 (full unrestricted access)
The JFFS custom scripts option is on.

#!/bin/sh is the first line in the script.

The file was not copied from my pc - rather I typed in manually in vi using an ssh terminal (putty) - so there is no file translation issue.

Also, like Roman, I can verify that it runs manually without issues by running directly /jffs/scripts/services-start from the command line.

Is it possible the custom jffs custom scripts option is not recognized as 'on' for some reason?
 
@Roman Welsch
I looked again at the syslog you posted.....the firmware is correctly finding the services-start script.
Code:
Jan  1 01:00:26 Samba Server: daemon is started
Jan  1 01:00:26 custom script: Running /jffs/scripts/services-start

So, a couple of things to try
- services-start kicks off pretty early and maybe the path hasn't been set yet. Try adding the full path for each of the commands.
- try inserting a sleep command after the shebang...maybe sleep 15 or so....
 
I just re-tested it, and services-start works fine here. Keep in mind that it runs a fair bit early, but if you put a touch entry in it:

Code:
touch /tmp/@@@services-start

It should be displayed:

Code:
admin@Stargate88:/tmp/home/root# ls -l /tmp/@@@*
-rw-rw-rw-  1 admin  root  0 Jul 31 20:00 /tmp/@@@services-start
 
Hi RMerlin if i write
touch /tmp/@@@services-start

i don't see nothing, the screen is empty

Roman

It's not something that you run over SSH, it's something that you put inside your services-start, immediately after the shebang (the #!/bin/sh line). It will create an empty @@@services-start file in /tmp when the script is run, confirming that it did run.
 
I just re-tested it, and services-start works fine here. Keep in mind that it runs a fair bit early, but if you put a touch entry in it:

Code:
touch /tmp/@@@services-start

It should be displayed:

Code:
admin@Stargate88:/tmp/home/root# ls -l /tmp/@@@*
-rw-rw-rw-  1 admin  root  0 Jul 31 20:00 /tmp/@@@services-start

Just installed fresh merling firmware version 378.55
formated the jffs
reboot router
Enabled JFFS custom scripts and configs
with ssh goto /jfss
mkdir scripts
vi firewall-start
type my line
wq (saving)
rebooted the router

When i run the code
touch /tmp/@@@services-start
I also see nothing.
And yes i started a ssh session from my linux pc like:
ssh admin@xxx.xxx.xxx.xxx
and type password then run the code.

Not working :(

edit:
when ik looked the log there is:
Jan 1 00:00:31 kernel: nf_nat_rtsp v0.6.21 loading
Jan 1 00:00:31 custom script: Running /jffs/scripts/firewall-start (args: eth0)
 
when ik looked the log there is:
Jan 1 00:00:31 kernel: nf_nat_rtsp v0.6.21 loading
Jan 1 00:00:31 custom script: Running /jffs/scripts/firewall-start (args: eth0)

Then it means the error is inside your script, as the firmware correctly saw the script, and tried to execute it.
 
OK.
In the firewall-start file is:
/usr/sbin/iptables -I INPUT -s xxx.xxx.xxx.xxx -p tcp --destination-port 5445 -j ACCEPT
 
OK.
In the firewall-start file is:
/usr/sbin/iptables -I INPUT -s xxx.xxx.xxx.xxx -p tcp --destination-port 5445 -j ACCEPT

You are missing a shebang:

Code:
#!/bin/sh
 
Ok the line:
#!/bin/sh
Must be the first line?
 
Last edited:
Ok the line:
#!/bin/sh
Must be the first line?

Yes. Every Linux script must start with a similar line, it tells the shell how the script must be executed.
 
Ok adder the line.
Look in tot the log and there was:
rc_service: udhcpc 573:notify_rc start_firewall
Oct 25 19:45:11 dhcp client: bound xx.xx.xxx.xxx via xx.xx.xxx.x during 3209 seconds.
Oct 25 19:45:11 start_nat_rules: apply the nat_rules(/tmp/nat_rules_eth0_eth0)!
Oct 25 19:45:11 custom script: Running /jffs/scripts/firewall-start (args: eth0)

Must try from the remote if the script is working.

Edit:
But when i run "touch /tmp/@@@services-start"
I see still nothing

Edit2:
Testet and seems its works.
 
Last edited:

Similar threads

Latest 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