954,249 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

[OpenSUSE 11.4]wget in after.local

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

henks
Newbie Poster
19 posts since Jul 2006
Reputation Points: 10
Solved Threads: 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?

rubberman
Posting Virtuoso
1,559 posts since Mar 2010
Reputation Points: 277
Solved Threads: 178
 

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

henks
Newbie Poster
19 posts since Jul 2006
Reputation Points: 10
Solved Threads: 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.

rubberman
Posting Virtuoso
1,559 posts since Mar 2010
Reputation Points: 277
Solved Threads: 178
 

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

henks
Newbie Poster
19 posts since Jul 2006
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: