Skip to content

Instantly share code, notes, and snippets.

@snorfsneflin
Forked from viviandarkbloom/Polycom reboot
Created November 9, 2015 22:35
Show Gist options
  • Save snorfsneflin/755773dc8f994cb7e0ce to your computer and use it in GitHub Desktop.
Save snorfsneflin/755773dc8f994cb7e0ce to your computer and use it in GitHub Desktop.
Reboot polycom phones
A bash "one-liner" that requires serious explaining:
A Polycom phone will automatically reboot if you change anything in its webui (but you have to change something). This bash/awk/curl loop changes the length of time between sntp resyncs (basically a super-trivial setting) from 86400 seconds (1 day) to 86401. If you run this twice, you would need to change 86401 back to 86400. This is a super-dirty hack. Also note that this sets the sntp server to pool.ntp.org, and the time zone to Pacific (-28800). Although those settings will get overridden if you're setting those in your DHCP scope (which you should), please adjust as necessary. To clarify, $i is an IP address. In this example, I get a list of phone IPs from asterisk and grep the ones I need to reboot, but you can iterate over any list of IPs.
----------
for i in $(asterisk -rx 'sip show peers' | grep 192.168.10 | awk '{print $2}'); do curl -s --user Polycom:456 -H application/x-www-form-urlencoded --referer http://$i/timeConf.htm -d "tcpIpApp.sntp.address=pool.ntp.org&tcpIpApp.sntp.gmtOffset=-28800&tcpIpApp.sntp.resyncPeriod=86400&tcpIpApp.sntp.daylightSavings.enable=1&tcpIpApp.sntp.daylightSavings.fixedDayEnable=0&tcpIpApp.sntp.daylightSavings.start.month=3&tcpIpApp.sntp.daylightSavings.start.date=8&tcpIpApp.sntp.daylightSavings.start.time=2&tcpIpApp.sntp.daylightSavings.start.dayOfWeek=1&tcpIpApp.sntp.daylightSavings.start.dayOfWeek.lastInMonth=0&tcpIpApp.sntp.daylightSavings.stop.month=11&tcpIpApp.sntp.daylightSavings.stop.date=1&tcpIpApp.sntp.daylightSavings.stop.time=2&tcpIpApp.sntp.daylightSavings.stop.dayOfWeek=1&tcpIpApp.sntp.daylightSavings.stop.dayOfWeek.lastInMonth=0&Submit1=Submit" http://$i/form-submit; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment