1

What will happen if i do a ifup wlan0 using cron once every hour?

Will it cause problems if the wifi is already up?

1

No. As @ppumkin said, ifup check if the interface is down first, exiting is already up. Second, there are some driver problems with some wifi module. When you turn off the interface, the driver is removed on the fly, and it's linked again when you turn on. Sometimes this second or later insertion doesn't work.

If you have such device, a simple solution is reboot the system.

| improve this answer | |
  • 2
    Hi Willian, I wanted to turn my wifi off on a night time and back on again using cron. If the power is interrupted in the night, the pi would reboot and turn the wifi on. So when morning comes, the wifi could be unexpectedly on, and the cron would try and turn it on again. That's why i wondered if it would upset the pi. – reggie Feb 20 '14 at 20:09
  • If you have a wired connection in your Raspberry, you could configure Wake On Lan, but it's not your case. There is a known problem with some wifi adapters and linux. Some modules doesn't have a good drive and the turn off/on fails. I'm afraid that if you have one of these devices, you need to reboot your raspberry instead of restart your wifi network. – Willian Paixao Feb 20 '14 at 20:14
  • @WillianPaixao Just to back your answer with a fact is that ifup first checks if the interface is up, if its down then it will do all the code to continue, otherwise it exits. That is why its OK to call it in a cron. – Piotr Kula Feb 21 '14 at 9:28
  • if it's ok to cron ifup, say every hour, then why are there scripts to re establish the wifi connection based on pinging the router or some other internet address? eg: github.com/dirttech/SmartMeter/blob/master/wifi_drop.sh – reggie Feb 21 '14 at 12:16
  • @WillianPaixao can you improve your answer with a few facts or something please. As it is, its a weak answer and could get removed. But otherwise I think its correct, just needs a fact or two. – Piotr Kula Feb 21 '14 at 14:47

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.