Last active
June 21, 2018 19:29
-
-
Save nathandarnell/b324ec587a5f1553ba9bbe95acf91eaf to your computer and use it in GitHub Desktop.
Sorts the Polycom directory and formats the XML to be prettier. Could be combined with "polycom-dir.sh" but keeping it separate now for testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Sorts the Polycom directory file by last name | |
# That original file is produced by: https://crosstalksolutions.com/freepbx-polycom-directory-automation/ | |
# XSL code taken from: https://stackoverflow.com/questions/28322438/sort-xml-in-alphabetic-order | |
# XSL file is at: https://gist.github.com/nathandarnell/0c7cac5e628a43b126f96d7c64970cf9#file-polycom-dir-xslt-xsl | |
# Runs every hour from "nano -w /etc/crontab" | |
# Make a temp file to output the formatted XML | |
touch /tftpboot/temp.xml | |
# Sort the XML directory file | |
xsltproc -o /tftpboot/temp.xml /usr/local/sbin/polycom-dir-xslt.xsl /tftpboot/000000000000-directory.xml | |
# Format the XML file and send it to the original file | |
xmllint --format /tftpboot/temp.xml > /tftpboot/000000000000-directory.xml | |
# Remove the temporary file | |
rm /tftpboot/temp.xml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment