genesisfm
Posts: 2
Joined: Sun Nov 25, 2012 8:56 pm

Help init.d problem

Sun Nov 25, 2012 8:59 pm

Hello,

I got a question i want to autostart something but im a totally noob with linux :x
I installed : http://www.hamradioscience.com/raspberr ... 2832u-sdr/
And that works.
But i want to start the following command when i put to raspberry on:

rtl_tcp -a 10.0.1.50

How can i do that?
I tryed to make a script like:
#! /bin/sh
# /etc/init.d./sdr

start() {
/usr/local/bin/rtl_tcp -a 192.168.1.101
}
exit 0


Best regards,

Rob

toldor
Posts: 4
Joined: Thu Nov 08, 2012 11:50 am

Re: Help init.d problem

Mon Nov 26, 2012 10:56 am

Maybe you dont need to make a script for it. You can put in a cronjob at start the script at reboot. And I think you should at a "&" at the end of the line so it is executed in the background.

sdjf
Posts: 1395
Joined: Fri Mar 16, 2012 5:20 am
Location: California
Contact: Website

Re: Help init.d problem

Mon Nov 26, 2012 3:10 pm

genesisfm wrote:








I tryed to make a script like:
#! /bin/sh
# /etc/init.d./sdr

start() {
/usr/local/bin/rtl_tcp -a 192.168.1.101
}
exit 0
Just so you understand scripting better, what you hav done is define a function without calling it. I am not even sure that /bin/sh will recognize functions. In such a script, you might want to use /bin/bash instead of /bin/sh. And after you finish defining your function, you would invoke it in the script.
You would do that, in this example, by entering the word "start" on a single line by itself, on a separate line after the } and before the exit. So, your script would end with the lines:
}
start
exit 0
FORUM TIP: To view someone's posting history, sign in, click on their user name, then on "Search User's Posts." || Running ArchLinuxArm on Model 2B and 512MB Model B

genesisfm
Posts: 2
Joined: Sun Nov 25, 2012 8:56 pm

Re: Help init.d problem

Fri Nov 30, 2012 6:38 pm

Thank you, i friend of mine solved my problem :x
Because i'm not into the scripting..

Return to “Beginners”