Add Telnet Command To Box Start Up

B16MCC

Dreambox Gimp & Coder
Joined
Nov 16, 2005
Messages
1,562
Reaction score
8
Points
0
Age
51
My Satellite Setup
2 Dreamboxes..........
---------------------------------------------
--- DM 8000 HD PVR & DM 800 HD ---
Motek SG2100 & Triax 80cm Dual LNB
------ Fixed Dish 28e Quad LNB -------
---- Sly HD Full & 24" Apple iMAC ----
My Location
/var/tuxbox/config
Hi peeps. Having 2 DM's I have my remote control programmed to control one DM on the Dream button and the other DM on the Shift Dream button ( AUX Mode).

To coinside with this I have to telnet the following commands to my boxes to ensure they only respond to the correct commands from the one remote.

Box 1 echo 1 > /proc/stb/ir/rc/mask0 (box responds to dream only)
Box 2 echo 2 > /proc/stb/ir/rc/mask0 (box responds to shift-dream only)

Without these commands the boxes repsond to both remote channels.

My question is , how would I add that command so its executed when the box powers up. This would save me from having to telnet in and set them manually if I reboot a box.

Thanks gang..
MCC
 

mhku

Super Moderator
Staff member
Joined
Mar 8, 2005
Messages
4,712
Reaction score
20
Points
38
My Satellite Setup
TM Nano ~ sg2100
My Location
Midlands
You can create a shell script and put it in /var/etc/init.d (I think that's the startup folder).

Use a UNIX compatible editor as you don't want any Windows/ DOS characters in it (especially carriage returns).

Code:
#!/bin/sh
echo 1 > /proc/stb/ir/rc/mask0
echo 2 > /proc/stb/ir/rc/mask0

You can add logging to it as well. I've not tested it so the folder may be wrong; usually in Linux you'd add scripts to a user's folder that fire when the user logs in.

_http://www.net42.co.uk/satellite/dreambox-hints.html
 

B16MCC

Dreambox Gimp & Coder
Joined
Nov 16, 2005
Messages
1,562
Reaction score
8
Points
0
Age
51
My Satellite Setup
2 Dreamboxes..........
---------------------------------------------
--- DM 8000 HD PVR & DM 800 HD ---
Motek SG2100 & Triax 80cm Dual LNB
------ Fixed Dish 28e Quad LNB -------
---- Sly HD Full & 24" Apple iMAC ----
My Location
/var/tuxbox/config
Thanks for the info , much appreciated. I use an IMAC running Leopard, so hopefully I should be ok with the standard text editor.

I'll have a play around and see how I go.
Thanks again.
MCC
 

mhku

Super Moderator
Staff member
Joined
Mar 8, 2005
Messages
4,712
Reaction score
20
Points
38
My Satellite Setup
TM Nano ~ sg2100
My Location
Midlands
You can also telnet into the Dreambox and create the file with the built-in editor (I think there's one, hopefully not VI).
 

B16MCC

Dreambox Gimp & Coder
Joined
Nov 16, 2005
Messages
1,562
Reaction score
8
Points
0
Age
51
My Satellite Setup
2 Dreamboxes..........
---------------------------------------------
--- DM 8000 HD PVR & DM 800 HD ---
Motek SG2100 & Triax 80cm Dual LNB
------ Fixed Dish 28e Quad LNB -------
---- Sly HD Full & 24" Apple iMAC ----
My Location
/var/tuxbox/config
ok so I tried your info. I made a file called remote and put it in /usr/etc/init.d

It did not have the desired effect on reboot. Should the file have a specific name at all ? Does it get executed simply because its in that folder ?

I basically wrote :-

#!/bin/sh
echo 2 > /proc/stb/ir/rc/mask0

and saved it in a file called remote in the init.d folder
Rebooted, it seems the command was not executed. The box responded to both remote channels rather than the expected channel 2 only(AUX)

Any further tips please mate ?
Cheers
MCC
 

mhku

Super Moderator
Staff member
Joined
Mar 8, 2005
Messages
4,712
Reaction score
20
Points
38
My Satellite Setup
TM Nano ~ sg2100
My Location
Midlands
I had a play over the weekend but couldn't find the file that is executed on boot up.

On a 500 a file called init in /etc will be executed on bootup (you may need to create it). I tried it with a 7020 but it didn't work.

It may be initab but I didn't have time to test it
 

B16MCC

Dreambox Gimp & Coder
Joined
Nov 16, 2005
Messages
1,562
Reaction score
8
Points
0
Age
51
My Satellite Setup
2 Dreamboxes..........
---------------------------------------------
--- DM 8000 HD PVR & DM 800 HD ---
Motek SG2100 & Triax 80cm Dual LNB
------ Fixed Dish 28e Quad LNB -------
---- Sly HD Full & 24" Apple iMAC ----
My Location
/var/tuxbox/config
Not tried this yet, gonna try it when I get home tonight. I believe I need to edit this file :- /etc/init.d/bootup

I need to insert my telnet command at the end of this file. Please bare in mind this folder structure will be different in enigma 1 images.
 

mhku

Super Moderator
Staff member
Joined
Mar 8, 2005
Messages
4,712
Reaction score
20
Points
38
My Satellite Setup
TM Nano ~ sg2100
My Location
Midlands
Backup the file before editing but you should be OK.
 

B16MCC

Dreambox Gimp & Coder
Joined
Nov 16, 2005
Messages
1,562
Reaction score
8
Points
0
Age
51
My Satellite Setup
2 Dreamboxes..........
---------------------------------------------
--- DM 8000 HD PVR & DM 800 HD ---
Motek SG2100 & Triax 80cm Dual LNB
------ Fixed Dish 28e Quad LNB -------
---- Sly HD Full & 24" Apple iMAC ----
My Location
/var/tuxbox/config
Well, tried adding my command to that file, it doesn't work ! I still have to telnet the command manually after a reboot. The quest continues....
 

compufunk

Regular Member
Joined
May 7, 2008
Messages
1,658
Reaction score
1
Points
38
My Satellite Setup
DM 600-S, VU+ Duo,
Moteck SG2100, Fracarro Penta 85 dish, LG LH3000 42" TV + some computers
My Location
NW, Ireland
If you haven't gotten that working yet.

It wont run unless the file is marked as executable so you'll need to change file permissions.
644 should become 744, you may even want to change it to 777 (executable by everyone).

I'm not sure what the correct directory is on a DB, on debian systems its /etc/init.d/

Code:
chmod 777 /etc/init.d/YourFileName

The above should do it, (change the directory and filename to suit your setup)
 

B16MCC

Dreambox Gimp & Coder
Joined
Nov 16, 2005
Messages
1,562
Reaction score
8
Points
0
Age
51
My Satellite Setup
2 Dreamboxes..........
---------------------------------------------
--- DM 8000 HD PVR & DM 800 HD ---
Motek SG2100 & Triax 80cm Dual LNB
------ Fixed Dish 28e Quad LNB -------
---- Sly HD Full & 24" Apple iMAC ----
My Location
/var/tuxbox/config
Thanks for that , I'll check it out. However , seeing as I'm editing a file that is supposed to be already executed on start up, shouldn't it be ok as it is ?
 

compufunk

Regular Member
Joined
May 7, 2008
Messages
1,658
Reaction score
1
Points
38
My Satellite Setup
DM 600-S, VU+ Duo,
Moteck SG2100, Fracarro Penta 85 dish, LG LH3000 42" TV + some computers
My Location
NW, Ireland
Im not sure about the file you mentioned "/etc/init.d/bootup".

I haven't checked it out on my DB yet, but any other Linux based system I've used I have always placed a new file in a folder called /etc/init.d or similar and it works well.

You could also try to find one of the startup files for services that start at boot like little apache and add the required files to its startup file.
 

compufunk

Regular Member
Joined
May 7, 2008
Messages
1,658
Reaction score
1
Points
38
My Satellite Setup
DM 600-S, VU+ Duo,
Moteck SG2100, Fracarro Penta 85 dish, LG LH3000 42" TV + some computers
My Location
NW, Ireland
Test the script too make sure it works before you add it to any startup folders or cron job.

To do this just type the full path and filename at the command line. e.g.

Code:
/root/StartupScript

If the script is correct and the permissions are set to execute then your remote should be functioning as you want it to at this point.
 

B16MCC

Dreambox Gimp & Coder
Joined
Nov 16, 2005
Messages
1,562
Reaction score
8
Points
0
Age
51
My Satellite Setup
2 Dreamboxes..........
---------------------------------------------
--- DM 8000 HD PVR & DM 800 HD ---
Motek SG2100 & Triax 80cm Dual LNB
------ Fixed Dish 28e Quad LNB -------
---- Sly HD Full & 24" Apple iMAC ----
My Location
/var/tuxbox/config
I checked the file in question and it was already set to 755. I set it to 777 anyway but it still doesn't run my telnet command.

I was told to use this file specifically on the IHAD forums. I'd have thought the guys over there would know these things. So I have no idea if I'm doing something wrong , or possibly the boot sequence is undoing my command later in the sequence perhaps.

The search continues.....
 

mhku

Super Moderator
Staff member
Joined
Mar 8, 2005
Messages
4,712
Reaction score
20
Points
38
My Satellite Setup
TM Nano ~ sg2100
My Location
Midlands
/etc/init.d/bootup - did you try a simple test line such as writing a to a text file in /tmp ?
 

compufunk

Regular Member
Joined
May 7, 2008
Messages
1,658
Reaction score
1
Points
38
My Satellite Setup
DM 600-S, VU+ Duo,
Moteck SG2100, Fracarro Penta 85 dish, LG LH3000 42" TV + some computers
My Location
NW, Ireland
Hi,
I managaed to get a script to run at startup last night, You were right to look at /etc/init.d/bootup.

I didnt try the command you are trying to get working, I just tested with some other commands. For the sake of tidiness i created a new file to run the commands I wanted then added the path to that file in /etc/init.d/bootup. This is cleaner because you only have one line added to the /etc/init.d/bootup file and you can modify the newly created file to do whatever you want at a later stage.

Make a backup of /etc/init.d/bootup

Create a new file to run your commands.
Code:
touch /home/root/boot_script
Add a few lines to the file using your favourite application.
I used the following.

Code:
echo "this file was created at boot time on " >  /tmp/boot_script_output
date >> /tmp/boot_script_output
Set the executable bit on the file.
Code:
chmod 755 /home/root/boot_script
Add the path to the script to a new line in /etc/init.d/bootup.
Code:
echo /home/root/boot_script >> /etc/init.d/bootup
Reboot the dreambox.

When the box has rebooted you should find a file called boot_script_output in the /tmp directory. Open it up, it should read something like
Code:
this file was created at boot time on 
Fri May 23 11:04:14 IST 2008
Add your own commands to the /home/root/boot_script file. If you are still having trouble I would suggest you redirect the output of your commands to a file. That way you can see any errors that were generated e.g.
Code:
 YourCommand >> /tmp/boot_script_output
To make sure your settings are not being overridden by something else in the boot sequence, just execute the script manually by typing the file path in at the command prompt. .

Code:
/home/root/boot_script
If running the script manually doesn't work then its not going to at boot.

Hope this helps.
 

compufunk

Regular Member
Joined
May 7, 2008
Messages
1,658
Reaction score
1
Points
38
My Satellite Setup
DM 600-S, VU+ Duo,
Moteck SG2100, Fracarro Penta 85 dish, LG LH3000 42" TV + some computers
My Location
NW, Ireland
I've just noticed, there are some double spaces in the code snippets above, If anyone is copying them, remove any double spaces to avoid problems.
 

compufunk

Regular Member
Joined
May 7, 2008
Messages
1,658
Reaction score
1
Points
38
My Satellite Setup
DM 600-S, VU+ Duo,
Moteck SG2100, Fracarro Penta 85 dish, LG LH3000 42" TV + some computers
My Location
NW, Ireland
Any luck with this B16MCC ?:)
 

BonceChops

Regular Member
Joined
Apr 27, 2004
Messages
259
Reaction score
0
Points
0
Age
54
My Satellite Setup
Dreambox 500, Dreambox 600PVR, Dreambox 7025+, Dreambox 7000, 1m dish on a Moteck SG2100
My Location
NW England
compufunk said:
Any luck with this B16MCC ?:)

It looks like he has changed his older 7025 for a 800s. He might be trying to work out how the remote works on the 800 now :)
 

dreamkain

Member
Joined
Feb 12, 2010
Messages
2
Reaction score
0
Points
0
Age
42
My Satellite Setup
too busy :p
My Location
Tunisia
Hi all
Having Dreambox 500, I want to display "hello world" on the TV screen.
Can anyone help me, where can I put the hello script file to do this.
Thanks.
 
Top