вторник, 4 февраля 2014 г.

Remote reboot D-Link 524UP


Frozen usb-modems in old routers such as D-Link 524UP makes me crazy. I had to collect stat info from four places and often d-link routers were offline. I found that D-Link has http request to reboot. And I added to PC with Linux, placed at the same place, simple script to check internet connection and reboot router if no internet connection.
 #!/bin/bash  
   
 ### google DNS ip ######  
 ip="8.8.8.8"  
   
 ping $ip -c 1 > /dev/null  
   
 #### 192.168.0.1 - local ip of wifi router #########  
   
 if [ $? -ne 0 ]  
 then  
 wget -q http://login:pass@192.168.0.1/Tools/reboot.xgi &>/dev/null  
 fi  
   

Create mail list in Zimbra mail server. Simple shell script.


 #!/bin/sh  
   
 # get all users list of mydomain.com   
 /opt/zimbra/bin/zmprov -l gaa mydomain.com > /opt/zimbra/scripts/users_mailbox.txt  
   
 # add users to mail list all@mydomain.com  
   
 for mbox in `cat /opt/zimbra/scripts/users_mailbox.txt`  
 do  
 echo "$mbox";  
 /opt/zimbra/bin/zmprov -l adlm all@maydomain.com $mbox  
 done