0

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? :(

2
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by henks
0

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?

Edited by rubberman: n/a

0

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 :)

0

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.

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.