User guide
- 117 -
Appendix M
How to Add Commands to
WebMux Startup Sequence
Sometimes there is a need to add commands to the WebMux startup sequence so that certain
commands can be reboot persistent. In 8.5.02 firmware release and later, there is a new
superuser command “sysinit” provided for the user to add iptables command or other
commands to the startup sequence. Please note that adding a wrong command to the startup
sequence may render the WebMux not accessible, thus it is always a good practice to test the
commands first before adding it to the WebMux startup sequence.
For example, if you want an SMTP server at 192.168.10.98 always appear to be sent from one
of your public IP addresses (i.e. 66.1.1.98) on the WebMux, you can use this iptables command:
iptables -t nat -I POSTROUTING -s 192.168.10.98 -d ! 192.168.10.98 \ -m multiport -p
tcp —destination-ports 25 -j SNAT —to-source 66.1.1.98
This command works the moment it is issued, but when you reboot the WebMux, it gets lost.
To make it reboot persistent, you want to add it to the WebMux startup sequence. You can
use the sysinit command to add the above command to the sysinit table in the WebMux, so
that it will always be executed during the WebMux startup.
The sysinit command has following syntax:
$ sysinit —help
usage: sysinit [—help] [—quiet] [—write]
—help print help
—quiet skip prompts and confirmation
—write write stdin to superuser’s sysinit script table
(without parameter will read existing table) The superuser’s sysinit table may contain any
commands that are allowed at the superuser’s command prompt. At system startup, it will be
run after networking has been started.
If typing or pasting new input, use control-D for EOF.
$ sysinit —write
sysinit: Enter new script up to EOF (cntl-D):
echo AAA >/dev/console
sysinit: You entered 23 bytes. [done]
$ sysinit
sysinit: reading sysinit file:
echo AAA >/dev/console
sysinit: sysinit file contains 23 bytes. [done]
For the purpose of the above example, the echo AAA will be saved in the sysinit table. If you
want to add a new command, it is always good idea to test them before adding to the sysinit
table. To clear the sysinit table, use a space and control-D to write a blank table into sysinit
table. Please note that sysinit table will not be send over to the backup WebMux. In case the
wrong command caused user no longer able to login into WebMux, use the LCD “factory
reset” to reset the sysinit table to blank.