I had problems with my raspberry pi disconnecting and never reconnecting to a WiFi-network. There are already several different solutions
http://raspberrypi.stackexchange.com/questions/4120/how-to-automatically-reconnect-wifi
http://www.forum-raspberrypi.de/Thread-wlan-reconnect-nach-verbindungsabbruch?page=2
This is mine:
- vim /usr/local/sbin/wlan-reconnect
- chmod +x /usr/local/sbin/wlan-reconnect.sh
- vim /etc/systemd/system/wlan-reconnect.timer
- vim /etc/systemd/system/wlan-reconnect.service
- systemctl daemon-reload