-
Notifications
You must be signed in to change notification settings - Fork 47
/
CrashPlan_-_Last_Backup.xml
25 lines (24 loc) · 1.4 KB
/
CrashPlan_-_Last_Backup.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?xml version="1.0" encoding="UTF-8"?><extensionAttribute>
<displayName>CrashPlan - Last Backup </displayName>
<description>This attribute displays the last time CrashPlan ran a backup. This attribute applies to both Mac .</description>
<dataType>date</dataType>
<scriptContentsMac>#!/bin/sh
CP_ServerAddress='Your Code 42 server'
CP_ServerPort="code 42 port number"
CP_AdminUsername="code42 api user"
CP_AdminPassword="code 42 api password "
if [ "$CP_ServerAddress" == "" ] || [ "$CP_ServerPort" == "" ] || [ "$CP_AdminUsername" == "" ] || [ "$CP_AdminPassword" == "" ];then
echo "Please ensure all variables are set in the extension attribute script."
else
if [ -f /Library/Application\ Support/CrashPlan/.identity ];then
GUID=`/bin/cat /Library/Application\ Support/CrashPlan/.identity | grep guid | sed s/guid\=//g`
value=`/usr/bin/curl -u "$CP_AdminUsername":"$CP_AdminPassword" -k https://"$CP_ServerAddress":"$CP_ServerPort"/api/DeviceBackupReport/?deviceUid="$GUID" | python -m json.tool | grep lastCompletedBackupDate | awk '{print $2}' | sed s/,//g | sed 's/.\(.*\)/\1/'| sed 's/T/ /' | cut -c -19`
result=`/bin/date -j -f "%Y-%m-%dT%H:%M:%S" "$value" "+%Y-%m-%d %H:%M:%S"`
echo "<result>$value</result>"
else
echo "<result>Not installed</result>"
fi
fi
</scriptContentsMac>
</extensionAttribute>