What's new

Should I have scripts I want to run at boot in the JFFS partition and can I do it from a USB stick instead?

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

bladox

New Around Here
I am a beginner when in comes to this, my area has frequent power outages, I want the router to check if my PC is on at every boot, and if it is off, to turn the PC on using Wake on LAN. My understanding is that if I want a script to run at boot, I should put it in the /jffs/scripts/ directory, but this page says:

I do not recommend doing frequent writes to this area, as it may prematurely wear out the flash chip. This is a good place to put files that are written once like scripts or kernel modules, or that rarely get written to. Do not put files that get constantly written to (such as high activity logfiles) - store these on a USB disk instead. Replacing a worn out USB flash disk is much cheaper than replacing the whole router if flash sectors get worn out.

Is there a way to run a script on boot that is stored in a USB stick?

Edit: I am using an Asus RT-AC66U B1 router
 
Last edited:
If I am correct, this kind of statement does not apply anymore those days, it used to be true some time ago.
That being said, in the BIOS of your PC you should find a parameter to tell it that in case of power outage it should come back either to OFF or last state (ON in your case).

BUT if you really want to do it via the router, it is possible indeed via a script in /jffs/scripts .... probably services-start where you can code the adequate ether-wake command

as an example, here one of mine:
Code:
#!/bin/sh
INTERVAL=5
TARGET=192.168.xx.xx
IFACE=br0
MAC=xx:xx:xx:xx:xx:xx
WOL=/usr/sbin/ether-wake
LOGFILE="/tmp/mnt/sda1/LOG/ether-wake.log"
echo "WAKE $TARGET at" `date`>> $LOGFILE
$WOL -i $IFACE $MAC
echo $WOL -i $IFACE $MAC >> $LOGFILE
echo >> $LOGFILE
exit
 
Last edited:
The BIOS on my laptop does not have that option, I'll store the script in the /jffs/script folder then, thank you for the response.
 
it is /jffs/scripts ....
 
I tried it but the script is not running on boot, it works if I run the file in a terminal and enter `./services-start.sh`, but it does not run at boot, this is the script I used.

```
#!/bin/sh
sleep 60
/usr/sbin/ether-wake -i br0 "xx:xx:xx:xx:xx:xx"
logger Sent WOL command to PC
```
I tried with the file named "init-start.sh", "services-start.sh", "nat-start.sh" and "firewall-start.sh", but none of them worked. The rights are listed as "rwxr-xr-x". Is there something I am doing wrong?
 
file name must be services-start
without .sh extension ; and that is the same for all others (firewall-start nat-start etc ....)
 

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