____________________________________________________________________________________
____________________________________________________________________________________
122
TAU-4M.IP Subscriber gateway
APPENDIX B. RUNNING USER-DEFINED SCRIPT UPON SYSTEM STARTUP
Periodically, it is necessary to perform certain actions at device startup, which cannot be performed by
specifying certain settings via the configuration file. For this case, TAU-4M.IP device provides the ability to
configure the launch of an arbitrary script through the configuration file, in which you can put any desired
sequence of commands.
For user-defined script execution, use the following settings section in the configuration file:
UserScript:
Enable: "0"
URL: ""
The 'Enable' option allows (if the value is 1) or denies (if the value is 0) the script launch, the path to which
is specified in the URL parameter.
The launched script can be located both on the remote server and on the device itself. From a remote
server, the script can be downloaded via HTTP or TFTP. Consider the examples of the configuration file to run a
custom script from different sources.
1.
Launch from HTTP server
To run the script from the HTTP server, you must specify the full path to the file in the format of the
HTTP URL in the URL parameter:
URL: 'http://192.168.0.250/user-script/script.sh'
In this case, after the device starts, the script.sh file stored in the user-script directory at
192.168.0.250 will be automatically downloaded via HTTP from the specified server, after which it
will be launched.
2.
Launch from TFTP server
To run the script from the TFTP server, you must specify the full path to the file in the format of the
TFTP URL in the URL parameter:
URL: 'tftp://192.168.0.250/user-script/script.sh'
In this case, after the device starts, the script.sh file stored in the user-script directory at
192.168.0.250 will be automatically downloaded via TFTP from the specified server, after which it
will be launched.
3.
Local script launch
Due to the file system features, the local script should be located only in the /etc/config directory,
since only the contents of this directory are saved after the device is rebooted. The script in the
/etc/config directory can be created either using the vi editor, or download it from an external TFTP
server (using the tftp –gl user.sh <TFTP-server address> command). After creating the script, it
needs to assign launch permissions with the chmod 777 command /etc/config/user.sh.
In the configuration file, the URL for launching a local script is:
URL: 'File://etc/config/user.sh'
It is important to note that the user script must begin with the directive #!/bin/sh.