Script Execution

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 13:16, 26 March 2007 (edit)
Cyberde (Talk | contribs)
(Script types - Added link to SES Button article)
← Previous diff
Revision as of 05:51, 27 July 2007 (edit) (undo)
200.92.91.77 (Talk)
(General infomration)
Next diff →
Line 3: Line 3:
-=General infomration=+=General information=
There are four different directories DD-WRT searches for scripts, these are There are four different directories DD-WRT searches for scripts, these are
/etc/config/ /etc/config/
Line 9: Line 9:
/mmc/etc/config/ /mmc/etc/config/
/tmp/etc/config/ /tmp/etc/config/
- 
=Script types= =Script types=

Revision as of 05:51, 27 July 2007

Contents

Introduction

Sometimes you want script to be executed automatically when something happens, this article explains how to make sure scripts get executed at a certainpoint.


General information

There are four different directories DD-WRT searches for scripts, these are

/etc/config/
/jffs/etc/config/
/mmc/etc/config/
/tmp/etc/config/

Script types

You need to add an extension to the script if placed in one of the previous folders. Every extension has it's own meaning.


Extension Explanation
.startup will be executed on system startup, normally boot-time and: _before_ the firewall is configured
.wanup will be executed whenever an interface goes up (ex: ppp connection is reestablished after a disconnect, goes up first time) and: _after_ firewall stuff, so good ending for custom QoS and stuf.
.if will be executed whenever an interface goes up (ex: ppp connection is reestablished after a disconnect, goes up first time) and: _after_ firewall stuff, so good ending for custom QoS and stuff - .wanup - should be a better place for disconnect/reconnect events than the ones above
.ipup is run when ppp connection is reestablished after a disconnect, _after_ firewall stuff.
.ipdown is run when a ppp connection has been shut down
.sesbutton is executed when the SES/AOSS/EZ-SETUP button is pressed

Execute scripts with a different extension or in a different folder

If you want to execute scripts with a different extension or those that are located in a other folder you can create this script

for I in `/bin/ls /jffs/etc/config/*.startup`
do
   sh $I &
done

Ofcourse you need to change the path (/jffs/etc/config) and the extension itself to match your desire.

How it works

The command sh /jffs/etc/config/*.startup will execute every script ending in .startup found in the /jffs/etc/config directory. By setting this as the rc_startup value, your *.startup scripts will load every time the router boots.


Links

Useful Scripts

Startup Scripts