You are on page 1of 3

2/16/13

Script Execution - DD-WRT Wiki

Log in / create account


Go

Main Page Community portal Current events Recent changes Random page Help Donations

Script Execution
From DD-WRT Wiki
You are here: DD-WRT wiki mainpage / Scripting / Script Execution

Contents
1 Introduction 2 General Information 3 Script Types 4 Execute Scripts with a Different Extension or in a Different Folder 5 How It Works 6 Links

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

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/
www.dd-wrt.com/wiki/index.php/Script_Execution 1/3

2/16/13

Script Execution - DD-WRT Wiki

Script Types
You need to add an extension to the script if placed in one of the previous folders. Every extension has its own meaning.

Extension Explanation .startup .prewall .wanup .if .ipup .ipdown .sesbutton will be executed on system startup, normally boot-time and before the firewall is configured. will be executed whenever the WAN interface goes up and before the firewall. will be executed whenever the WAN interface goes up and after the firewall. will be executed whenever any interface goes up and after the firewall. (no longer in source code, must be deleted) is run when PPP connection is reestablished after a disconnect and after the firewall. is run when a PPP connection has been shut down. (no longer in source code, must be deleted?) is executed when the SES/AOSS/EZ-SETUP button is pressed

Remember to change permissions on any script files using chmod (chmod +x script_name) to permit execution. Scripts with .wanup may be run several times when the router boots. ( see http://www.ddwrt.com/phpBB2/viewtopic.php?p=433984 ). People using WinSCP to transfer files to their router can right click on the filename after uploading and select "Properties" to change permissions.

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 an other folder you can create this script
frIi `bnl /fseccni/.yxeso`d o n /i/s jf/t/ofg*metnin;o s $ & h I dn oe

Of course 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/*.myextension will execute every script ending in .myextension found in the /jffs/etc/config directory. By setting this as the rc_startup value, your *.myextension scripts will load every time the router boots.

Links
www.dd-wrt.com/wiki/index.php/Script_Execution 2/3

2/16/13

Script Execution - DD-WRT Wiki

LED Scripts Startup Scripts Useful Scripts Retrieved from "http://www.dd-wrt.com/wiki/index.php/Script_Execution" Category: Scripts

Article | Discussion | Edit | History What links here | Related changes | Upload file | Special pages | Permanent link Print as PDF This page was last modified 17:41, 22 March 2012. This page has been accessed 102,433 times. About DD-WRT Wiki | Disclaimers | Powered by MediaWiki | Design by Paul Gu

www.dd-wrt.com/wiki/index.php/Script_Execution

3/3

You might also like