Posted: Wed Dec 05, 2018 16:32 Post subject: Startup Script Not Working
I have a script which creates firewall rules for all my security cameras which works perfectly fine when run manually; however, when added to the startup scripts, it not working for some reason.
I've already done "chmod 755 ipcamsblock.sh". The line of code in startup is "/opt/scripts/ipcamsblock.sh". The line underneath it for YAMon3 works fine and is "/opt/YAMon3/startup.sh 10".
I've tried to "cat /var/log/messages" but cannot see anything which would give me a clue as to why the script doesn't work automatically.
Any ideas? I really need this fixed so I can trust the cameras are not being exposed to the internet whenever the router reboots.
P.S. Why can I not revise my post after posting or make another post without the stupid error about not being able to post. I'm not a bot!
What's strange to me is the code runs fine if I have it in the startup script commands area of DD-WRT but if I paste the same code into it's own script and call the script from the startup script, it doesn't work, even though I've made the script with execute permissions, 775.
Code:
# Pause 10 seconds before applying firewall rules
sleep 10
While the script works with the she-bang, it doesn't work always if I don't pause for 10 seconds. I assume some other process/actions need to occur before you can begin applying iptable rules ... is there code which would allow me to pause until it's actually ready rather than guessing 10 seconds and waiting to long or not long enough?