Problem with timing of start-up scripts in Slacko (Solved)

Booting, installing, newbie
Post Reply
Message
Author
AdrianH
Posts: 64
Joined: Thu 17 Oct 2013, 21:45
Location: Blackburn in the UK

Problem with timing of start-up scripts in Slacko (Solved)

#1 Post by AdrianH »

I am getting partial success. I think it may be a timing issue with a command starting too soon but do not know how to prove or correct.

in the directory /etrc/rc.d is the file rc.local
I have modified its contents as below

Code: Select all

#this file called from rc.sysinit
#you can edit this file
#When firewall is installed, will append lines to this file...
/usr/etc/ice
/usr/etc/dark
/usr/etc/sound
In /usr/etc I have added three scripts generated using the file manager

ice
dark
sound

Ice is as below:

Code: Select all

#!/bin/sh
icecast -c /etc/icecast.xml &
dark is as below:

Code: Select all

#!/bin/sh
darkice -c /etc/darkice.cfgl &

sound is as below:

Code: Select all

#!/bin/sh
rsd &

It all seems to run when the computer boots up

but checking with top shows only icecast and rsd as active

darkice is not

if I then run

/usr/etc/dark

it will appear in top.

I know that normally, manual entry of /usr/etc/ice will return text to the screen, something like changed userid to 65534, and I need to press the enter key before I get the # symbol back on screen

Similar so does /usr/etc/dark return text to console.

So not sure if I have to enter more lines of something into rc.local or if it is a case of icecast is not up and running correctly when darkice is called.


Can anyone tell me where I am going wrong.

Cheers

Adrian

AdrianH
Posts: 64
Joined: Thu 17 Oct 2013, 21:45
Location: Blackburn in the UK

#2 Post by AdrianH »

I have also tried a few more things by adding #!/bin/sh as the first line in rc.local and ensured that the file is executable, and got the same results, still no darkice running.

Cheers

Adrian

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#3 Post by mikeb »

Ok not familiar with your daemons but if you suspect a need to start in a particular order why not combine into one script called with & to background it from rc.local.

Then you can try different orders having one wait for the other ...or adding sleeps if stubborn.

The method would then resemble other daemon startup scripts such as in init.d.....at the moment each is starting independantly in an unpredictable way.

Another thought is the network may not be ready and the one that fails might need it.

mike

AdrianH
Posts: 64
Joined: Thu 17 Oct 2013, 21:45
Location: Blackburn in the UK

#4 Post by AdrianH »

Hi Mike;

I have re-arranged then within rc.local so that it runs ice first, the sound then dark and still no change Ice and sound run (rsd).

Icecast uses the network connections so I have assumed that must be up before hand.

Do you mean change rc.local so that it is as follows:

Code: Select all

#!/bin/sh
#this file called from rc.sysinit
#you can edit this file
#When firewall is installed, will append lines to this file...
icecast -c /etc/icecast.xml &
darkice -c /etc/darkice.cfg &
rsd &
I will try that now and also swap rsd and darkice around, let me know if I have this wrong.

How do you add sleeps?

Cheers

Adrian

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#5 Post by mikeb »

Not quite but try it anyway...

My thoughts were....

rc.local ....

Code: Select all

/usr/etc/myscript &
then /usr/etc/myscript is..

Code: Select all

#!/bin/sh

icecast -c /etc/icecast.xml &
rsd & 
darkice -c /etc/darkice.cfg &
I assume these binaries do not self daemonise.
sleep 1
adds a one second delay...so just add where you think it may help and time to suit. (before the one that fails?

hope that makes sense
mike

AdrianH
Posts: 64
Joined: Thu 17 Oct 2013, 21:45
Location: Blackburn in the UK

#6 Post by AdrianH »

Mike

I was just typing another effort when my email pinged so
just tried rc.local as

Code: Select all

#!/bin/sh
#this file called from rc.sysinit
#you can edit this file
#When firewall is installed, will append lines to this file...
icecast -c /etc/icecast.xml &
rsd &
darkice -c /etc/darkice.cfg &
and still the same type of result no showing of darkice on top

Not sure how to see any outputs or error messages

I will try sleep 1

I also assume sleep 4 would wait 4 seconds

The binaries do not normally deamonise sorry rsd can by running it as

rsd -D

icecast and dark ice not that I can find.

I will try sleep and also your method.

Thanks for the time

Adrian

User avatar
OscarTalks
Posts: 2196
Joined: Mon 06 Feb 2012, 00:58
Location: London, England

#7 Post by OscarTalks »

Just wanted to say I ran icecast server with darkice and darksnow in Slacko 5.3.3 some while back and it all worked perfectly. I just started it all manually at the time though. I don't recall if darkice needs icecast to already be up and running in order to start. You could just try running darkice in console on its own to test that.

You can also put your scripts in /root/Startup and adding a sleep line before your exec line (even sleep 20) will sometimes prove useful because it allows all the other needed processes to get going first. Sounds like the others are starting OK, so try delaying the start of darkice by a few seconds.
Oscar in England
Image

AdrianH
Posts: 64
Joined: Thu 17 Oct 2013, 21:45
Location: Blackburn in the UK

#8 Post by AdrianH »

I used sleep starting up from 1, 2, 3 etc

sleep 3 was a bit hit and miss, sleep 4 seems to have been reliable so I have used sleep 5.

Just going through a continuous retry but looks as though it is an answer to my problem thanks mikeb for your help.

Hi Oscar,

Good idea, I have just tried darkice before icecast and got an error TcpSocket.cpp:251: connect error [111]

So looks as though it is a case of icecast not being ready.

Cheers

Adrian

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#9 Post by mikeb »

ah good...well it did sound like sleep was needed hence the need to have a separate script.

rc.local is only run once...starup may get run more than once say if x resolution was changed so the former avoids the possibility of 2 instances of the same daemon.

A more sophisticated approach than using sleep is to detect when a needed process is doing its job but coming up with a way is not always obvious or even possible.

glad you got sorted

mike

AdrianH
Posts: 64
Joined: Thu 17 Oct 2013, 21:45
Location: Blackburn in the UK

#10 Post by AdrianH »

Your help and that of anyone else is greatly appreciated mike, I will be asking lots on here to get my project complete.


Cheers

Adrian

I note my header is now solved, thanks to whoever did this I should have done it myself

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#11 Post by mikeb »

Just saw your other thread.... since you run headless, X and therefore startup would never run.....
the plot thickens like a good sauce.

mike

Post Reply