User Scripts

From WikiDLXTV
Revision as of 11:30, 14 July 2011 by B-rad.cc (Talk | contribs)

Jump to: navigation, search

About

The inner workings of WDLXTV can be modified by advanced users who wish to run their own shell script at boot time to either launch applications, or patch over a read-only file and replace it with another file that they are providing.

NONE of these require reflashing to utilize

There are 3 options:

  • S00custom-options : This script is placed on an attached usb device, before power up. If you visit the webend WDLXTV configurator your S00custom-options will be disabled.
    • Designed for 'one-off' options, like config_tool settings. If you have something more permanent refer to one of the scripts below.
  • /conf/S00user-script : This is a permanent version of S00custom-options. You create this file yourself and upload it to /conf.
  • /conf/S99user-script : This is like S00user-script, although instead of being executed at the start of the init.d 'startup script' process it is executed after everything else has run.

All init.d / startup scripts are executed in numerical/alphabetical order.

Note : if /conf/S00user-script or /conf/S99user-script contain errors your system will not boot.

Note 2 : All of these are executed only at boot time.

Here is the minimum that must be included in a user script:

#!/bin/sh

logger -s -t `basename $0` "this statement is not actually mandatory, but helps you know if your script actually executed.

Examples

Scripts run from USB

S00custom-options

Have a look here for a list of available config settings.

Example script

This script will change the background image back to the WD default background.

#!/bin/sh
config_tool -c BACKGROUND_IMAGE=original_bg.jpg


Scripts run from /conf

S00user-script

Example script

This script does does the following:

  • Write a start message to /tmp/messages.txt
  • sleep for 1 second
  • Write an end message to /tmp/messages.txt
#!/bin/sh
logger -t "S00user-script" -p notice "start"
sleep 1
logger -t "S00user-script" -p notice "end"


S99user-script

Example script

This script does does the following:

  • Write a start message to /tmp/messages.txt
  • sleep for 1 second
  • Write an end message to /tmp/messages.txt
#!/bin/sh
logger -t "S99user-script" -p notice "start"
sleep 1
logger -t "S99user-script" -p notice "end"


Links