找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2077|回复: 4

RT2.93可用的命令行命令

[复制链接]
发表于 2010-4-18 08:32:38 | 显示全部楼层 |阅读模式
刚去RT官网逛了一圈,找到了不少好东西,以下是RT2.93可用的命令行命令,大家一起来研究下吧
RouterTech Firmware: extra command line tools (Firmware v2.93)



These commands are mostly in /usr/local/bin/

  • adam2-defragenv.sh - a script to defragment the Adam2 bootloader environment. Read the features.html file for full information
  • adblock.sh and adblock_multi.sh - to assist in blocking popup adverts and other nasties (if adblock_multi.sh is run with no parameters, it will download a default lnumber of block lists)
  • auto_defragenv.sh - a script to defragment the environment after the fragmentation level has passed a specified threshold (default 30 for Adam2, and 50 for PSPboot)
  • autoexec.sh (and autoexec1.sh to autoexec7.sh) - runs whatever is passed to it; useful for running things when the router reboots
  • bandwidth.sh - allows you to throttle the bandwidths of those who have exceeded a specified transfer bandwidth (default 500mb), and to display bandwidth usage data. Run it without any parameter to see the syntax. Requires IP Account to be enabled
  • check_env - a rough and ready check to see whether the bootloader environment is fragmented (a return of "0" means that the environment does not appear to be fragmented, and "1" means that it appears to be fragmented).
  • checksync.sh - enables sync monitoring in crontab
  • chksync - checks whether there is a WAN connection, and, if not, reboots the router
  • cron_disable.sh - sets the router to NOT start "crond" automatically (writes to the bootloader environment)
  • cron_enable.sh - returns to the default (to start "crond" automatically) (writes to the bootloader environment)
  • cronjob.sh - acts as a shell to set up cron jobs more easily, and makes the cron job persistent by making an entry into the bootloader environment
  • cronjob-env.sh - acts as a shell to set up cron jobs more easily
  • cron_la.sh - enables the monitoring of line attenuation in crontab
  • darkstat - captures network traffic, calculates statistics about usage, and serves reports over HTTP.
  • detachfs - to unmount all mounted minix, smbfs, ftpfs, etc., partitions/mountpoints only
  • deletemtd.sh - delete the mtd5 partition and restore the mtd partition table to the values before a new mtd partition was created (wireless routers only)
  • diagnostics.sh - shows router diagnostic information
  • edit - easy to use editor (wireless routers only)
  • ether-wake (similar to wakelan)
  • fetch_driver - fetches the usb driver or the ftpfs driver from the repository, extract the driver module, load the driver, and optionally run a command. Run the command without any parameters to see the syntax.
  • fetch_ds - fetch darkstat from the repository, extract, and run it. It can either the run manually, or via autoexec.sh.
  • filecomp.sh - compare the sizes of two files
  • filesize.sh - report the size of a file
  • flush - to flush all pending writes to minix/smbfs partitions so that they are not lost if the router is switched off without shutting down properly. Ideally, this command should be run every time you write to a minix/smbfs partition. If you have any mounted smbfs partitions, then you need to supply the username and password to the flush command (these are ignored in respect of minix partitions, but are needed in order to reload smbfs partitions)
  • ftp - ftp client for getting files to/from the router's /var directory (wireless routers only)
  • ftpmount - allows you to mount directories from an ftp server (after loading the ftpfs driver). Run the command with no parameter for the syntax.
  • mjproxy - a very small proxy for SIP.
  • getenv - shows the environment variables (in the bootloader environment - "/proc/ticfg/env" for the PSP boot loader, or "/proc/sys/dev/adam2/environment" for the Adam2 boot loader)
  • linecount.sh - returns the number of lines in a text file (or "-1" on error). Empty lines and comment lines (beginning with a "#") will be ignored. If you want comment lines to be counted as well, then supply the switch: "--with-comments".
  • listconnections.sh - lists the current connections
  • localnat.sh - enables local NAT loopback - experimental
  • makemtd.sh - create a new mtd partition (and, optionally, a minix filesystem) automatically (wireless routers only). Run the command with no parameters to get the syntax.
  • memchk.sh - enables memory monitoring and optimisation in crontab
  • memopt.sh - runs the memory optimiser
  • netdate - updates the system date/time from a remote time server, using the RFC868 protocol
  • netshaper - allows you to limit the bandwidth by IP addresses/ranges (you need to run "setenv netshaper_enable 1" and reboot before you can use it) (wireless routers only)
  • onconnectWAN - this is executed (after being copied to /var/tmp/) by the ip-up script when a WAN connection is achieved; by default it runs crond and darkstat (if they are enabled)
  • pixelserv - a tiny webserver that serves up a single pixel to any request; it is useful for blocking adverts by means of "dns poisoning"
  • pppHB.sh - half-bridge script - experimental
  • printenv - same as getenv
  • reset-config.sh - reset the router's configuration to defaults. Use this command only when everything else fails (i.e., reset from the web interface fails)
  • rshaperctl - allows you to limit the bandwidth by IP addresses/ranges (you need to run "setenv rshaper_enable 1" and reboot before you can use it)
  • saveall.sh - saves all config changes
  • save-reboot.sh - saves all config changes and reboots
  • setdate - to update the system date/time, using the netdate command
  • setenv - sets an environment variable (in the bootloader environment) - run "setenv -h" for further information)
  • sft_start.sh - starts the "small FTP server" (sft) to receive files on port 5556
  • siproxd - starts siproxd (wireless routers only)
  • showdns.sh - shows the ISP's DNS information
  • showip.sh - shows your WAN IP (pppoa connections only)
  • show_la.sh - sends line attenuation information to the system log
  • showlog.sh - shows the contents of the system log
  • show_nat_settings.sh - shows the current NAT settings
  • start_httpd.sh - starts the firmware's http server, optionally specifying the http server's port (the default port is 80). This script runs during the boot-up process to start the http server for the web configuration. You can set the http_port environment variable to a different port if required (or to "none" - meaning don't start the http server at all!)
  • ucast_solicit.sh - works around routing problems on the networks of two (which shall remain nameless) UK ISPs (they should really sort out their equipment!)
  • time - displays the current system time
  • udpxy - allows you to relay multicast UDP traffic to a client's TCP (HTTP) connection (unicast)
  • unsetenv - delete a variable from the bootloader environment
  • usb_disable.sh - sets the router to NOT start USB automatically (writes to the bootloader environment)
  • usb_enable.sh - returns to the default (to start USB automatically) (writes to the bootloader environment)
  • usb_start.sh - starts USB
  • usb_stop.sh - stops USB
  • ver - display version information (and a whole load of other useful information)
  • wakelan - wakes up PCs on the LAN (run "wakelan --help" for further information)
  • wan_uptime - shows how long the router has been connected to the outside world for
  • wol_forward - to wake a machine on the LAN from outside the network


The following are RouterTech firmware helper programs, and should NOT be run directly: rt_dc; rt_word2; mtd3_app; rebt

See other commands below.

NOTES:
Of the above shell scripts, the following can be executed on bootup by making entries for them in the bootloader environment ("/proc/ticfg/env" for the PSP boot loader, or "/proc/sys/dev/adam2/environment" for the Adam2 boot loader).

Examples:
1. autoexec.sh (and autoexec1.sh up
to
autoexec7.sh)
e.g.,

setenv autoexec.sh "wget http://fpp.com/bar.sh -P /var && chmod a+x /var/bar.sh && /var/bar.sh"
This will set up the router to fetch a script (bar.sh) from a website, set its executable flag, and then run it, everytime the router boots up.

2. checksync.sh
e.g.,


setenv checksync.sh "1"
This will set up the router to monitor the router sync status every hour

setenv checksync.sh "1 30"
This will set up the router to monitor the router sync status every 30 minutes of every hour

3. cron_la.sh
e.g.,

setenv cron_la.sh "2"
This will set up the router to log the line attenuation figures every 2 hours

4. memchk.sh
e.g.,

setenv memchk.sh "1"
This will set up the router to run the memory optimiser every hour

setenv memchk.sh "1 15"
This will set up the router to run the memory optimiser every 15 minutes of every hour


5. RT_cmd_<x>
Here, "x" stands for a number or other unique identifier (e.g., "RT_cmd_1"). This feature allows you to specify certain commands to be executed automatically when the router boots up.
e.g.,
setenv RT_cmd_1 "rshaperctl 192.168.1.3 524288"
This will set up the router to run the rshaperctl commmand on bootup, to throttle the bandwidth of the computer at 192.168.1.3 to no more than 512kbps.

6. RT_init_<x>
Here, "x" stands for a number or other unique identifier (e.g., "RT_init_sys1"). This feature allows you to specify certain commands to be executed automatically when the router boots up, at a very early stage of the bootup process.
e.g.,
setenv RT_init_rshaper "rshaperctl 192.168.1.3 524288"
This will set up the router to run the rshaperctl commmand on bootup, to throttle the bandwidth of the computer at 192.168.1.3 to no more than 512kbps.
or
setenv RT_init_shaper2 "netshaper -d 192.168.1.3 524288"
This will set up the router to run the netshaper commmand on bootup, to throttle the bandwidth of the computer at 192.168.1.3 to no more than 512kbps.


Other RouterTech Firmware Commands

/bin/
  • chmod
  • df
  • egrep
  • grep
  • hostname
  • kill
  • mkdir
  • more (wireless routers only)
  • mount
  • netstat
  • rmdir
  • sed
  • touch
  • true
  • uname

/usr/bin/
  • basename
  • clear
  • cm_cli_ex (a version of cm_cli that allows redirection of its output)
  • du (wireless routers only)
  • expr
  • find
  • free
  • id
  • killall
  • Led (to manipulate the router's leds)
  • printf
  • sort
  • test
  • tftp
  • which (wireless routers only)

/sbin/
  • fsck.minix (check a minix filesystem (wireless routers only))
  • mkfs.minix (creates a minix filesystem (wireless routers only))


others (all over the place)
  • crond
  • crontab
  • gunzip
  • gzip
  • logger (allows you to write a message to the system log)
  • sft (small ftp server)
  • tar
  • top (displays currently running processes and important information about them)

And a whole host of others ...
发表于 2010-4-18 14:31:30 | 显示全部楼层
这个不错,

有些技术性

学习了。
发表于 2010-4-21 23:21:00 | 显示全部楼层
有没有中文的说明啊?
发表于 2010-4-22 19:25:57 | 显示全部楼层
有没有中文的说明啊?
 楼主| 发表于 2010-4-24 20:40:25 | 显示全部楼层
回ls的兄弟,没有中文的,不过有兴趣的可以翻译一下
*滑块验证:
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|宽带技术网 |网站地图 粤公网安备44152102000001号

GMT+8, 2025-5-19 00:48 , Processed in 0.025088 second(s), 3 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表