From KonradSC in IRC:
Code:
#!/bin/bash
read -p "Enter the Domain to Reboot (example: abc.encoretg.net):" domain
read -p "Enter the phone type to reboot (polycom, yealink, cisco):" vendor
read -p "Enter the time in seconds to pause between phones:" pausetime
NOW=$(date +"%Y%m%d_%H%M%S")
FILE="registrations-$NOW.csv"
eval 'fs_cli -x "show registrations" > $FILE'
N=0
ARR=()
IFS=","
INPUT=$FILE
[ ! -f $INPUT ] &while read reg_user realm extra
do
if [ "$realm" = "$domain" ]; then
echo "$reg_user@$realm"
eval 'fs_cli -x "luarun app.lua event_notify internal reboot $reg_user@$realm $vendor"'
if [ "$pausetime" > 0 ]; then
sleep $pausetime
fi
fi
done < $INPUT
IFS=$OLDIFS
rm $FILE