Created
June 17, 2020 14:16
-
-
Save jmbwell/413f03d798a40b573ee32679cfb3e27e to your computer and use it in GitHub Desktop.
Scrape the date and time of the last "Completed" backup from CrashPlan's history log, for use as a Jamf extension attribute. Works on a local system, no need to query the server's API.
This file contains hidden or 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/sh | |
# Grep the CrashPlan history.log.0 file for "Completed" and get the date and time | |
# Note: check the path of the log file for your environment | |
result=$(grep Completed /Library/Logs/CrashPlan/history.log.0 | tail -1 | awk '{ print $2 " " $3 }') | |
# Reformat CrashPlan's ad-hoc date format into a standard format | |
reformatted=$(date -j -f "%m/%d/%y %H:%M%p" "${result}" "+%Y-%m-%d %H:%M:%S") | |
# Output the result for Jamf | |
echo "<result>${reformatted}</result>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment