Skip to content

Commit

Permalink
Fix cachepath
Browse files Browse the repository at this point in the history
  • Loading branch information
bochoven committed Sep 19, 2019
1 parent e7e715e commit 29f3865
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/appusage
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ if [ "$1" = 'manualcheck' ]; then
fi

# Munki database check

CWD=$(dirname $0)
CACHEDIR="$CWD/cache/"
MANAGEDINSTALLDIR=$(/usr/bin/python -c "from Foundation import CFPreferencesCopyAppValue; print CFPreferencesCopyAppValue('ManagedInstallDir', 'ManagedInstalls')")

if [[ -f "${MANAGEDINSTALLDIR}"/application_usage.sqlite ]]; then

/usr/bin/sqlite3 "${MANAGEDINSTALLDIR}"/application_usage.sqlite <<!
.headers off
.mode csv
.output /usr/local/munki/preflight.d/cache/appusage.csv
.output ${CACHEDIR}appusage.csv
SELECT event, bundle_id, app_version, app_path, number_times, last_time FROM application_usage;
!

Expand All @@ -25,7 +26,7 @@ elif [[ -f /private/var/db/application_usage.sqlite ]]; then
/usr/bin/sqlite3 /private/var/db/application_usage.sqlite <<!
.headers off
.mode csv
.output /usr/local/munki/preflight.d/cache/appusage.csv
.output ${CACHEDIR}appusage.csv
SELECT event, bundle_id, app_version, app_path, number_times, last_time FROM application_usage;
!

Expand Down

0 comments on commit 29f3865

Please sign in to comment.