Example TV Server script: Scheduling TVs to turn off via RS-232
The IPTV 250m set-top box receiver can be used to send RS-232 commands to an attached screen via optional Encoded Media USB to RS-232 cable.
This KB Article details an example script which triggers the TV Server appliance to connect with every set-top box connected to it, and then have each box send the required RS-232 commands to power off an attached screen at a predetermined time.
The commands in the example script are specific to NEC MultiSync LCD4020 and LCD4620 displays, but can be adapted to suit any RS-232 compatible TV or panel by modifying the sequence of commands sent.
Though scripts are tested extensively, the downloading of example code either in whole or in part is done so entirely at your own risk. Encoded Media cannot accept responsibility for errors, omissions or unwanted behaviour arising from your use of example code.
The steps to initiate the script are as follows:
- Download the plain text file attached to this message. Edit the HOUR_ON and HOUR_OFF values to reflect the hour of day during which you wish the commands to be sent.
- Access your TV Server console.
- Select Maintenance (5), then Advanced (4), then Launch Command Shell (3)
- Add a new hourly cron job by running the following command at the prompt:
- Paste the contents of the text file you downloaded earlier and save the job by pressing CTRL+X followed by pressing Y to confirm.
- Now make the script file executable with the following command:
- Next, edit crontab by running the following command at the prompt:
- Now edit the following line so that the first column is as follows:
- Save your new configuration by pressing CTRL+X followed by pressing Y to confirm.
chmod a+x /etc/cron.hourly/rs232
0 * * * * root cd / && run-parts --report /etc/cron.hourly
The number in the first column denotes the minutes past the hour at which the job will run. In the line provided above the job runs on the hour, every hour. For testing purposes, you can alter this number to trigger sooner.
* If you do not know the root password for the IPTV 250m set-top box, please raise a support ticket with Encoded Media by emailing email@example.com