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 user to add iptables command or other command to the startup sequence. Please note that adding a wrong command to the startup sequence may render the WebMux not acessible, 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 the SMTP server at 192.168.10.98 always appear sending from one of your public IP address 188.8.131.52 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 184.108.40.206
This command works, but when you reboot WebMux, it gets lost. To make it reboot persistent, you want to add it to WebMux startup sequence. You can use sysinit command to add the above command to the sysinit table in the WebMux, so that it will always executed during WebMux startup.
The sysinit command has following synax:
$ 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 (please not factory reset will wipe out all configuration you made, including IP addresses and farms).