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!

Roman Welsch

Occasional Visitor
Hi , i have a little issue with the custom scripts, i make this 3 custom scripts

****************************************
cd /jffs/scripts
vi services-start

#!/bin/sh
MOVISTAR_TV_IP=10.100.130.80
MOVISTAR_TV_MASK=255.192.0.0
MOVISTAR_TV_GW=10.64.0.1
robocfg vlan 2 ports "0t 5t"
vconfig add eth0 2
ifconfig vlan2 $MOVISTAR_TV_IP netmask $MOVISTAR_TV_MASK up
ip route add to 172.26.0.0/16 via $MOVISTAR_TV_GW
ip route add to 172.23.0.0/16 via $MOVISTAR_TV_GW
/usr/sbin/igmpproxy /jffs/configs/igmpproxy.conf

cd /jffs/scripts
vi firewall-start

#!/bin/sh
iptables -I INPUT -p igmp -i vlan2 -d 224.0.0.0/4 -j ACCEPT
iptables -I INPUT -p udp -m udp -i vlan2 -d 224.0.0.0/4 -j ACCEPT
iptables -I FORWARD -p igmp -i vlan2 -d 224.0.0.0/4 -j ACCEPT
iptables -I FORWARD -p udp -i vlan2 -m udp -d 224.0.0.0/4 -j ACCEPT
iptables -I FORWARD -o vlan2 -j ACCEPT
/bin/echo 0 > /proc/sys/net/ipv4/conf/vlan2/rp_filter
/bin/echo 0 > /proc/sys/net/ipv4/conf/br0/rp_filter

cd /jffs/scripts
vi nat-start

#!/bin/sh
iptables -t nat -I POSTROUTING -o vlan2 -j MASQUERADE
/bin/echo 0 > /proc/sys/net/ipv4/conf/vlan2/rp_filter
/bin/echo 0 > /proc/sys/net/ipv4/conf/br0/rp_filter

cd /jffs/scripts
chmod a+x *

cd /jffs/configs
vi igmpproxy.conf

quickleave
phyint vlan2 upstream ratelimit 0 threshold 1
altnet 172.26.0.0/16;
altnet 172.23.0.0/16;
phyint br0 downstream ratelimit 0 threshold 1

******************************************************************

i can start manualy with this commands:

cd /jffs/scripts
./services-start
./firewall-start
./nat-start

but when reload the router the scripts dont start automatically ? any idea what may happen
 
And you have done like this, and use full path?

/jffs/scripts/services-start
/jffs/scripts/firewall-start
/jffs/scripts/nat-start

chmod a+rx /jffs/scripts/*
 
Last edited:
Roman check:
Administration -> System -> Enable JFFS custom scripts and configs
I newer firmware it is already turned on, therefore i didn't mentioned that.
 
I newer firmware it is already turned on, therefore i didn't mentioned that.

It's not. It defaults to disabled, otherwise in case of a rogue script, you would be unable to regain control of your router even after a factory default resets.
 
It's not. It defaults to disabled, otherwise in case of a rogue script, you would be unable to regain control of your router even after a factory
Custom script is off, but /jffs is formated and on. (my fault)

378.55 Beta 1 (3-July-2015)
- CHANGED: The JFFS2 partition is now always enabled, as it is
required by various firmware functions. The options
to format it or to enable/disable user config/scripts
remain configurable.
 
Last edited:
Hello i try to put the commands with the full path and when reload the scripts dont start automatically.

i will try to to a reset factory to the router and check again.

thanks for our help

regards

Roman
 
Hello , this night i was reset to factory the router an format the jffs partion and write another time the scripts
i have the same issue the scripts dont start automaticaly when reload the router.

i change the comands with the full path and change the chmod mode but i cant fix it.

any idea ?

regards for your our help

congratulations for this good community

Roman
 
I have also same issue also started a threath.
http://www.snbforums.com/index.php?threads/27263/
Reinstalled all nothing helper.
So use now. Tomatousb because i can make there advance rules.
But wifi is worse with tomatousb.
Prefere merlin .
I hope the issue het solved.
 
Hello , this night i was reset to factory the router an format the jffs partion and write another time the scripts
i have the same issue the scripts dont start automaticaly when reload the router.
i change the comands with the full path and change the chmod mode but i cant fix it.
any idea ?
regards for your our help
congratulations for this good community
Roman

Are you sure you dont have <CR><LF> at the end of every raw. In linux you only need <LF> and start evrey scrip with a shebang #!/bin/sh
To make sure you can do this right use eg Winscp to connect and paste your script in with that. Then you make sure CR is't in end of raw.

Your file should look like this in eg winscp.
DXHwy66.jpg


Octopus
 
Use "logger" statements to prove that scripts are running - I suspect that they do run but changes are lost due to things that happen later - such as route tables being regenerated on wan up way after services-start.
 
The syslog will also automatically contain entries that it correctly found the script and tried to execute it (or if running of scripts is disabled)
 
The syslog will also automatically contain entries that it correctly found the script and tried to execute it (or if running of scripts is disabled)

Yes, for example my wan-start includes

Code:
logger "WAN Up: New IP address is $(nvram get wan_ipaddr)"

which results in

Code:
Oct 17 15:35:52 custom script: Running /jffs/scripts/wan-start (args: 0)
Oct 17 15:35:52 admin: WAN Up: New IP address is ...

NB the log demon won't be running early enough to log messages from init-start
 
hello , thank for everybody for our help , i dont have more experience with linux commands and im not sure that the script was ok for me is very strange the scripts start manually but not auto...

when config the router with vi command i was use putty and paste directly with the notepad or wordpad the commands in text plane. i think i dont use CR at the end off lines .

i review the syslog and i see this

Oct 18 19:37:47 custom script: Running /jffs/scripts/nat-start
Oct 18 19:37:47 custom script: Running /jffs/scripts/firewall-start (args: ppp0)

the router start only 2 scripts nat-start and firewall-start, but dont start auto the script services.


why ??

attached the syslog of my router when reboot the router .

thanks for our help this software for asus routers its very nice !! a lot off possibilities

Roman
 
Double check your script's filename. If it doesn't get logged, then it means the firmware can't see the script at all.
 
Hi RMerlin thanks for your fast help :) sorry i don't understand very well what i have to do...

i review the name off the 3 scripts and the commands and the 3 are ok and correctly asked .

when you said " If it doesn't get logged, then it means the firmware can't see the script at all." i don't understand what do you mean.

Thanks for your patience

Roman
 
Hi RMerlin thanks for your fast help :) sorry i don't understand very well what i have to do...

i review the name off the 3 scripts and the commands and the 3 are ok and correctly asked .

when you said " If it doesn't get logged, then it means the firmware can't see the script at all." i don't understand what do you mean.

Thanks for your patience

Roman

What is the exact name of your services-start script?
 

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