Subsections


1.1 OPT_USERCMD - Execution Of User Defined Commands At System Start/Shutdown

1.1.1 Configuration

Opt_usercmd can execute arbitrary commands and scripts after boot or shutdown. Possible examples would be:

You may include own files residing in the config directory into the fli4l image.

The following entries are used:

OPT_USERCMD

Default Setting: OPT_USERCMD='no'

OPT_USERCMD='yes' activates the package. Only then the configured commands and scripts will be excuted on system start resp. shutdown.

USERCMD_BOOT_N

Default Setting: USERCMD_BOOT_N='0'

Number of commands/scripts to be executed after system start (boot). The rows will be processed consecutively.

USERCMD_BOOT_x

Default Setting: USERCMD_BOOT_x='echo user-defined boot-command here'

Command to be executed at system startup.


Important: For each entry only one command may be entered. If more commands are placed in a row, the have to be separated with a semicolon (See examples)

USERCMD_HALT_N

Default Setting: USERCMD_HALT_N='0'

Number of commands/scripts to be executed when shutting down the system (halt, shutdown, reboot). The rows will be processed consecutively.

USERCMD_HALT_x

Default Setting: USERCMD_HALT_x='echo user-defined halt-command here'

Command to be executed at system shutdown.


Important: For each entry only one command may be entered. If more commands are placed in a row, the have to be separated with a semicolon (See examples)

USERCMD_FILE_N

Default Setting: USERCMD_FILE_N='0'

Sometimes it may be necessary to include own files in fli4l's opt.img (it is currently not possible to integrate files in rootfs.img) without separate opt-package. For these cases a small number of files may be included directly from <config>/etc/usercmd into the fli4l image.

USERCMD_FILE_N='x' indicates the number of files to be integrated.

USERCMD_FILE_x_SRC

Filename of the source file in <config>/etc/usercmd. Only files residing in this directory will be integrated!

USERCMD_FILE_x_DST

Fully qualified filename to set the destination of the file in fil4l's image. A filename specified like this may i.e. on system boot be executed by a
USERCMD_BOOT_x='/usr/bin/mystuff.sh'.

USERCMD_FILE_x_MODE

File mode of the file in fli4l's image. Unix file modes stick to the usual Unix conventions. For details see the developer documentation 'List of files to copy' (see also [*]) or check Wikipedia http://en.wikipedia.org/wiki/Filesystem_permissions#Traditional_Unix_permissions.

USERCMD_FILE_x_FLAGS

Complies with flags= indication from the opt/<package>.txt file. See also [*].

The following options exist to convert text file formats before inclusion in the image:

utxt Conversion to Unix format
dtxt Conversion to DOS format
sh Shell scripts: Conversion to Unix format, removal of unnecessary characters, recommended for shell scripts

1.1.2 Examples

USERCMD_BOOT_x='fli4lctrl dial pppoe'
Establishes a DSL Internet connection after booting.

USERCMD_BOOT_x='sleep 60; ip link set tr0 down; ip link set tr0 up'
Sets a one-minute break after system startup, then switches the interface tr0 down and up again. Can be used to provide time for a Token Ring switch to allow for booting and then restart the network.

USERCMD_BOOT_N='1'
USERCMD_BOOT_1='cp /data/log/imond.log /var/log/'
USERCMD_HALT_N='2'
USERCMD_HALT_1='cp /var/log/sys.log /data/log/sys`date +%Y%m%d`.log'
USERCMD_HALT_2='fli4lctrl hangup pppoe ; sleep 2 ; cp /var/log/imond.log /data/log/'
Restores a previously saved imond log file at the end of the boot process. At shutdown, the syslog is saved with the current date in the file name, the DSL Internet connection is disconnected and the imond log file is saved.

1.1.3 Support

Support is provided only in the context of the fli4l Newsgroups.

1.1.4 Comments

© 2001-2016 The fli4l-Team - 16 February 2016