InfoDepot Wiki

READ MORE

InfoDepot Wiki
Register
Advertisement

Your here: Home/WiFi/DD-WRT Tutorials/Useful Scripts

Certain scripts can enhance the function of your router with DD-WRT, giving it more features or customizing it towards your needs.

To find out how to load scripts onto the router, see Startup Scripts.



Other Useful Misc. Script Commands

These scripts will be executed through either SSH or Telnet. Once logged into you router via one of these methods, the following are quite useful:

df - Displays mounted external devices, such as USB storage.  Use df -h to see the actual size values in MB
mount - Mounts an external device such as a USB HDD (Example:  mount /dev/scsi/host0/bus0/target0/lun0/part1 /opt
mount --bind - Binds an old directory to a new directory (Example: mount --bind /tmp/mnt/tmp) - Type mount --help to see more options.
umount - Unmounts the external device
top - Displays all running processes including the CPU usage, Memory Usage and so on
dmesg | more - Will display Router information one segment at a time (terminal window size) and by hitting enter, the next segment is produced
netstat -an - Will display all incoming/outgoing connections
ps - Will display all running processes - Use ps --help to display more options.
free - Displays current memory statistics, and be used with extensions (Example: free -l) - Use free -? to display options
cat - Very, very useful and can display all input/output messages from the router"  (Example: cat /tmp/var/log/messages) - Use cat --help for more options.
nvram show - Displays every nvram variable and available nvram space
nvram set - Set the value of an nvram variable (Example: nvram set rc_firewall="echo hello")
nvram commit - Commits nvram variables to the flash chip
reboot - Reboots the router, and must be used after an nvram commit
cd /jffs - Changes to the jffs directory
cd /mnt - Changes to the mounted directory
cd /opt - Changes to the /opt directory

These commands can also be be bound. (Example: cd /mnt/opt/etc)

NOTE:  The following commands are used when the above commands have been executed


mkdir - Makes a directory, in which of course you need to specify (Example: mkdir /mnt/jffs) To mount the directory you just created, issue the following mount /mnt/jffs /jffs
rmdir - Removes the specified directory
rm - Removes a directory (Example: cd /opt then rm -rf *) -> Removes the/opt directory
killall - kill a specific process (Example: killall syslogd)
sleep - Causes the process to delay startup for specified time (Example: sleep 20 && /opt/bin/busybox swapon /dev/scsi/host0/bus0/target0/lun0/part2)
chown - Change the owner and/or group of each FILE to OWNER and/or GROUP - Type chown --help for string options
chmod - Allows permisions changing on directories (Example: chmod +x /jffs/etc/config/) - The +x string makes the directory executable.
stopservice - Stops the specified service (Example: stopservice upnp) - Replace stop with start to start the service

See Also

Startup Scripts
Script Examples

Advertisement