Friday 15 August 2014

networking - Hourly network device restart using Bash in Ubuntu -


OK, this is a strange one. Actually what I am trying to do is run an infinite loop with a gold timer which delays running a wlan0 command to restart the network interface. It seems strange but for some reason the network card stops connecting to the net after about two hours. To stop it, I'm running a web server for this closed UNI and should be able to access it remotely. If the connection goes down then I'm out of luck. :

I found this: It is a very easy way to manage a network interface, reconfiguring only when pinging is off, though it is more complex than I have and some other similar bits Found, but they were equally ambiguous.

Honestly, I am a C-based programmer. At this stage, C # C ++ and Java (Python is not really worth mentioning) Anyway I'm just having fun reading a bake code, which modifies the already existing snippet. :)

So that's what I would like to do in the pseudo code.

  do {sleep 3600s // works sudo ifconfig wlan0 down // works on terminal but not script} while (false);   

It is so beautiful that the script is initially running by the user manually or through the start-up application system, I would like to have it automatic but if the ifconfig command is run as pseudo Which means that the script is run as a pseudo :)

More suggestions and / or signs will be appreciated. I tried to do old echo work to enter the password for the pseudo but as expected, Ubuntu developers have detected how blocking it.

Just got it and this is the second one that I want, but it's running other Bash scripts ???? :)

Editing -1: Okay .... well I used the crontab and I think that I am getting some work, I am not seeing any proof of it as When I call down the ifconfig wlan0 command line But I will leave it to walk tomorrow and see if he can keep himself online :) If not, and I am not thinking what can I do from here?

The way the connection is configured by working on this particular device below is that the command takes the device offline after 20 seconds and then the device automatically finds the network back and again Connects. :) I have no problem with the IP address tied to the MAC address :)

if You want to write a shell script which is up to you, but I'm a big fan of reusing the one that is already there.

Use your script to run every hour, set it to the root account and mess with the interface.

No comments:

Post a Comment