33# This script will process Caching Server Debug Logs and e-mail the information to relevant parties
44# through the use of Apple's Server Alert mechanism.
55# # Written by Erik Gomez with help from Google Search.
6- # # Last Modified 09/09 /2015
6+ # # Last Modified 09/16 /2015
77
88# # Variables
99loglocation=/Library/Server/Caching/Logs
@@ -159,6 +159,8 @@ egrep -o "(8.4.1)" "${tmplocation}"/Total_iOS.txt > "${tmplocation}"/iOS_8.4.1.t
159159# ## iOS 9
160160# # Look for only "9.0" and output
161161egrep --only-matching -E ' ' 9' \.(0)$' " ${tmplocation} " /Total_iOS.txt > " ${tmplocation} " /iOS_9.0.txt
162+ # # Look for only "9.1" and output
163+ egrep --only-matching -E ' ' 9' \.(1)$' " ${tmplocation} " /Total_iOS.txt > " ${tmplocation} " /iOS_9.1.txt
162164
163165# # Use wc to count the lines from each file to give you a reasonable estimate of total numbers.
164166# ## iOS 8
@@ -175,6 +177,7 @@ totalios840number=`wc -l "${tmplocation}"/iOS_8.4.txt | awk '{print $1}'`
175177totalios841number=` wc -l " ${tmplocation} " /iOS_8.4.1.txt | awk ' {print $1}' `
176178# ## iOS 9
177179totalios900number=` wc -l " ${tmplocation} " /iOS_9.0.txt | awk ' {print $1}' `
180+ totalios910number=` wc -l " ${tmplocation} " /iOS_9.1.txt | awk ' {print $1}' `
178181
179182# # Anything containing the phrase "%model" means it is model type related. Read the merged log and output to new file
180183egrep -o " (\s(model\S+))" " ${tmplocation} " /URL_Log-" ${yesterday} " .log | cut -d " " -f 2 > " ${tmplocation} " /Total_models.txt
@@ -200,6 +203,8 @@ totalipodnumber=`wc -l "${tmplocation}"/Total_iPod.txt | awk '{print $1}'`
200203totalappletv31=` egrep -o " (AppleTV3,1)" " ${tmplocation} " /Total_models.txt | wc -l | awk ' {print $1}' `
201204# # Look for "AppleTV3,2" and output
202205totalappletv32=` egrep -o " (AppleTV3,2)" " ${tmplocation} " /Total_models.txt | wc -l | awk ' {print $1}' `
206+ # # Look for "AppleTV5,3" and output
207+ totalappletv53=` egrep -o " (AppleTV5,3)" " ${tmplocation} " /Total_models.txt | wc -l | awk ' {print $1}' `
203208
204209# # Device Identifiers iPhone (Only 3,1 and higher can run iOS 8)
205210# # Look for "iPhone3,1" and output
@@ -222,6 +227,10 @@ totaliphone62=`egrep -o "(iPhone6,2)" "${tmplocation}"/Total_models.txt | wc -l
222227totaliphone72=` egrep -o " (iPhone7,2)" " ${tmplocation} " /Total_models.txt | wc -l | awk ' {print $1}' `
223228# # Look for "iPhone7,1" and output
224229totaliphone71=` egrep -o " (iPhone7,1)" " ${tmplocation} " /Total_models.txt | wc -l | awk ' {print $1}' `
230+ # # Look for "iPhone8,1" and output
231+ totaliphone81=` egrep -o " (iPhone8,1)" " ${tmplocation} " /Total_models.txt | wc -l | awk ' {print $1}' `
232+ # # Look for "iPhone8,2" and output
233+ totaliphone82=` egrep -o " (iPhone8,2)" " ${tmplocation} " /Total_models.txt | wc -l | awk ' {print $1}' `
225234
226235# # Device Identifiers iPad (Only 2,1 and higher can run iOS 8)
227236# # Look for "iPad2,1" and output
@@ -265,6 +274,10 @@ totalipad47=`egrep -o "(iPad4,7)" "${tmplocation}"/Total_models.txt | wc -l | aw
265274# # Look for "iPad4,8" and output
266275totalipad48=` egrep -o " (iPad4,8)" " ${tmplocation} " /Total_models.txt | wc -l | awk ' {print $1}' `
267276
277+ # # Look for "iPad5,1" and output
278+ totalipad51=` egrep -o " (iPad5,1)" " ${tmplocation} " /Total_models.txt | wc -l | awk ' {print $1}' `
279+ # # Look for "iPad5,2" and output
280+ totalipad52=` egrep -o " (iPad5,2)" " ${tmplocation} " /Total_models.txt | wc -l | awk ' {print $1}' `
268281# # Look for "iPad5,3" and output
269282totalipad53=` egrep -o " (iPad5,3)" " ${tmplocation} " /Total_models.txt | wc -l | awk ' {print $1}' `
270283# # Look for "iPad5,4" and output
@@ -273,6 +286,8 @@ totalipad54=`egrep -o "(iPad5,4)" "${tmplocation}"/Total_models.txt | wc -l | aw
273286# # Device Identifiers iPod (Only 5,1 and higher can run iOS 8)
274287# # Look for "iPod5,1" and output
275288totalipod51=` egrep -o " (iPod5,1)" " ${tmplocation} " /Total_models.txt | wc -l | awk ' {print $1}' `
289+ # # Look for "iPod5,1" and output
290+ totalipod71=` egrep -o " (iPod7,1)" " ${tmplocation} " /Total_models.txt | wc -l | awk ' {print $1}' `
276291
277292# # Output data.
278293echo A total of $totaliosnumber iOS devices hit the Caching Server yesterday consisting of:
@@ -286,12 +301,14 @@ echo " $totalios820number iOS 8.2 Devices"
286301echo " $totalios830number iOS 8.3 Devices"
287302echo " $totalios840number iOS 8.4 Devices"
288303echo " $totalios841number iOS 8.4.1 Devices"
289- echo " $totalios900number iOS 9.0 [Currently in Beta] Devices"
304+ echo " $totalios900number iOS 9.0 Devices"
305+ echo " $totalios910number iOS 9.1 Devices [Currently in Beta]"
290306echo
291307echo Of these devices, here is the model breakdown:
292308echo " $totalappletvnumber Total AppleTVs"
293309echo " $totalappletv31 3rd Generation Apple TVs"
294310echo " $totalappletv32 4th Generation Apple TVs"
311+ echo " $totalappletv53 5th Generation Apple TVs"
295312echo " $totaliphonenumber Total iPhones"
296313echo " $totaliphone31 iPhone 4 [GSM]"
297314echo " $totaliphone33 iPhone 4 [CDMA]"
@@ -303,6 +320,8 @@ echo " $totaliphone61 iPhone 5S"
303320echo " $totaliphone62 iPhone 5S [China Model]"
304321echo " $totaliphone72 iPhone 6"
305322echo " $totaliphone71 iPhone 6 Plus"
323+ echo " $totaliphone81 iPhone 6S"
324+ echo " $totaliphone82 iPhone 6S Plus"
306325echo " $totalipadnumber Total iPads"
307326echo " $totalipad21 iPad 2nd Generation [Wifi]"
308327echo " $totalipad22 iPad 2nd Generation [Wifi + GSM]"
@@ -325,8 +344,11 @@ echo " $totalipad44 iPad Mini 2nd Generation [Wifi]"
325344echo " $totalipad45 iPad Mini 2nd Generation [Wifi + Cellular]"
326345echo " $totalipad47 iPad Mini 3rd Generation [Wifi]"
327346echo " $totalipad48 iPad Mini 3rd Generation [Wifi + Cellular]"
347+ echo " $totalipad51 iPad Mini 4th Generation [Wifi]"
348+ echo " $totalipad52 iPad Mini 4th Generation [Wifi + Cellular]"
328349echo " $totalipodnumber Total iPods"
329350echo " $totalipod51 iPod Touch 5th Generation"
351+ echo " $totalipod71 iPod Touch 6th Generation"
330352echo
331353
332354
@@ -368,7 +390,7 @@ echo " $total10102number OS X Yosemite 10.10.2 Devices"
368390echo " $total10103number OS X Yosemite 10.10.3 Devices"
369391echo " $total10104number OS X Yosemite 10.10.4 Devices"
370392echo " $total10105number OS X Yosemite 10.10.5 Devices"
371- echo " $total10110number OS X El Capitan 10.11.0 [Currently In Beta] Devices "
393+ echo " $total10110number OS X El Capitan 10.11.0 Devices [Currently In Beta]"
372394echo
373395
374396
@@ -477,12 +499,14 @@ echo " $totalios820number iOS 8.2 Devices" >> "${tmplocation}"/Alert
477499echo " $totalios830number iOS 8.3 Devices" >> " ${tmplocation} " /AlertInfo.txt
478500echo " $totalios840number iOS 8.4 Devices" >> " ${tmplocation} " /AlertInfo.txt
479501echo " $totalios841number iOS 8.4.1 Devices" >> " ${tmplocation} " /AlertInfo.txt
480- echo " $totalios900number iOS 9.0 [Currently In Beta] Devices" >> " ${tmplocation} " /AlertInfo.txt
502+ echo " $totalios900number iOS 9.0 Devices" >> " ${tmplocation} " /AlertInfo.txt
503+ echo " $totalios910number iOS 9.1 Devices [Currently In Beta]" >> " ${tmplocation} " /AlertInfo.txt
481504echo " " >> " ${tmplocation} " /AlertInfo.txt
482505echo " Of these devices, here is the model breakdown:" >> " ${tmplocation} " /AlertInfo.txt
483506echo " $totalappletvnumber Total AppleTVs" >> " ${tmplocation} " /AlertInfo.txt
484507echo " $totalappletv31 3rd Generation Apple TVs" >> " ${tmplocation} " /AlertInfo.txt
485508echo " $totalappletv32 4th Generation Apple TVs" >> " ${tmplocation} " /AlertInfo.txt
509+ echo " $totalappletv53 5th Generation Apple TVs" >> " ${tmplocation} " /AlertInfo.txt
486510echo " $totaliphonenumber Total iPhones" >> " ${tmplocation} " /AlertInfo.txt
487511echo " $totaliphone31 iPhone 4 [GSM]" >> " ${tmplocation} " /AlertInfo.txt
488512echo " $totaliphone33 iPhone 4 [CDMA]" >> " ${tmplocation} " /AlertInfo.txt
@@ -494,6 +518,8 @@ echo " $totaliphone61 iPhone 5S" >> "${tmplocation}"/Ale
494518echo " $totaliphone62 iPhone 5S [China Model]" >> " ${tmplocation} " /AlertInfo.txt
495519echo " $totaliphone72 iPhone 6" >> " ${tmplocation} " /AlertInfo.txt
496520echo " $totaliphone71 iPhone 6 Plus" >> " ${tmplocation} " /AlertInfo.txt
521+ echo " $totaliphone81 iPhone 6S" >> " ${tmplocation} " /AlertInfo.txt
522+ echo " $totaliphone82 iPhone 6S Plus" >> " ${tmplocation} " /AlertInfo.txt
497523echo " $totalipadnumber Total iPads" >> " ${tmplocation} " /AlertInfo.txt
498524echo " $totalipad21 iPad 2nd Generation [Wifi]" >> " ${tmplocation} " /AlertInfo.txt
499525echo " $totalipad22 iPad 2nd Generation [Wifi + GSM]" >> " ${tmplocation} " /AlertInfo.txt
@@ -516,16 +542,19 @@ echo " $totalipad44 iPad Mini 2nd Generation [Wifi]" >>
516542echo " $totalipad45 iPad Mini 2nd Generation [Wifi + Cellular]" >> " ${tmplocation} " /AlertInfo.txt
517543echo " $totalipad47 iPad Mini 3rd Generation [Wifi]" >> " ${tmplocation} " /AlertInfo.txt
518544echo " $totalipad48 iPad Mini 3rd Generation [Wifi + Cellular]" >> " ${tmplocation} " /AlertInfo.txt
545+ echo " $totalipad51 iPad Mini 4th Generation [Wifi]" >> " ${tmplocation} " /AlertInfo.txt
546+ echo " $totalipad52 iPad Mini 4th Generation [Wifi + Cellular]" >> " ${tmplocation} " /AlertInfo.txt
519547echo " $totalipodnumber Total iPods" >> " ${tmplocation} " /AlertInfo.txt
520548echo " $totalipod51 iPod Touch 5th Generation" >> " ${tmplocation} " /AlertInfo.txt
549+ echo " $totalipod71 iPod Touch 6th Generation" >> " ${tmplocation} " /AlertInfo.txt
521550echo " " >> " ${tmplocation} " /AlertInfo.txt
522551echo " A total of $totalosxnumber OS X devices hit the Caching Server yesterday consisting of:" >> " ${tmplocation} " /AlertInfo.txt
523552echo " $total10100number OS X Yosemite 10.10.0/10.10.1 Devices [Cannot distinguish between builds]" >> " ${tmplocation} " /AlertInfo.txt
524553echo " $total10102number OS X Yosemite 10.10.2 Devices" >> " ${tmplocation} " /AlertInfo.txt
525554echo " $total10103number OS X Yosemite 10.10.3 Devices" >> " ${tmplocation} " /AlertInfo.txt
526555echo " $total10104number OS X Yosemite 10.10.4 Devices" >> " ${tmplocation} " /AlertInfo.txt
527556echo " $total10105number OS X Yosemite 10.10.5 Devices" >> " ${tmplocation} " /AlertInfo.txt
528- echo " $total10110number OS X El Capitan 10.11.0 [Currently In Beta] Devices " >> " ${tmplocation} " /AlertInfo.txt
557+ echo " $total10110number OS X El Capitan 10.11.0 Devices [Currently In Beta] " >> " ${tmplocation} " /AlertInfo.txt
529558echo " " >> " ${tmplocation} " /AlertInfo.txt
530559echo " A total of $totalurlnumber files were downloaded from the Caching Server yesterday consisting of:" >> " ${tmplocation} " /AlertInfo.txt
531560echo " $totalepubnumber Books" >> " ${tmplocation} " /AlertInfo.txt
0 commit comments