I just upgraded my 11.1 to 11.4

I need to run some shell script from a certain server everytime I power on the computer. So I added some bash script in /etc/init.d/after.local :

wget http://some.web/bashfile
bash bashfile
rm -rf bashfile

this code run just well on 11.1, but after i upgraded it to 11.4, the following error occurs:

Connecting to some.web:80... failed: No route to host.

so then i tried to manually run the script after i logged on, and it runs perfectly! My guess is that the network wasn't up yet when the code run (yeah, i just made sure of it by inserting

ping -c 2 some.web

into the after.local file, which resulting Destination Unreachable)

Any suggestion please? :(

Recommended Answers

All 4 Replies

What OS is running on the server? Has it been updated recently? You also may want to see if your iptables firewall services are running, and if so, what the rules are that it is using. It may be that some of the firewall rules are affecting this.

Also, have you tried this after the system boots up, from a root command line?

I don't know about the server's OS, because i'm not the one maintaining it. But I'm sure it is one of linux distros. I turned off all of firewall services, so I think it's not firewall.
Yes I tried that after system boots up and it run just fine.

I finally added some delay before the wget function using

sleep 20

and that did the trick, although not at all in the fancy way. I might go further with checking networks services first before running these commands, though I don't know yet how.

Thanks for the reply rubberman :)

Well, it takes a small (but distinct) amount of time before your network interfaces (and other services) are up and running after they start. Adding a 20-30 second delay in the script isn't a bad idea, and if it works as you say, then I'd say that is an appropriate solution. BTW, is your workstation using DHCP to get a network address? If so, then that would explain the delay needed as it takes a bit of time for a DHCP client to obtain an address and set up the network appropriately.

The computer uses static addressing. Yeah, delay works for now i think :) thanks.. I will label this as solved :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.