1

I want an executable program to run on startup. For this reason, I created a shell script: /etc/init.d/server. Then I run chmod +x name_of_script and update-rc.d server defaults.

server (script):

#!/bin/sh
cd /home/root/
./Server_msg

Server_msg prints the messages from a client. Messages are received on static IP address 192.168.1.200.

Note: The connection is wireless: Static IP address 192.168.1.200 gets assigned to the device, by a script running also on startup, which loads the Wi-Fi driver's adapter.

The problem:

When I added script server to run on startup as well, system is unable to run both scripts.

Any ideas?

1

By default, if you use:

update-rc.d server defaults

then update-rc.d will make links to start your server service in runlevels 2345 and to stop in runlevels 016, all these links have sequence number 20.

If server script depends on other services, e.g networking. So when server script start while its depending services haven't started yet, it will fail.

To be sure that server script only run when all its depending services have started, you can give server script higher priority:

update-rc.d server defaults 90

or add it to /etc/rc.local.

1
  • Problem solved afrer running update-rc.d server defaults 90. Thank you!
    – dempap
    Apr 9 '14 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.