Hi @bconcertiv,
While the "$HOME" variable may work natively on your computer, Jamf runs as root so the expected folder will often be different. To resolved this, most Jamf admins determine the actual user's file path by using
currentUser=$( /usr/bin/last -1 -t console | awk '{print $1}' )
You can test backing up the user's bookmark with this script:
#!/bin/bash
#Script to backup Chrome bookmark file to a specified location
#Shaquir Tannis 6-30-20
#Get current user
currentUser=$( /usr/bin/last -1 -t console | awk '{print $1}' )
#Chrome bookmark location
userChromeBookmark="/Users/"$currentUser"/Library/Application Support/Google/Chrome/Default/Bookmarks"
#Location to save bookmark
backupBookmark="/path/to/backuplocation/"
#Check if file exists and backup if it does
if [[ -f "$userChromeBookmark" ]]; then
#Backup Chrome bookmark file
cp "$userChromeBookmark" "$backupBookmark"
else
echo "No Bookmark file found"
fi
@shaquir Thank you this works perfectly. I really appreciate it.
The currentUser line above no longer works in Ventura. Swap in:
currentUser=$( scutil <<< "show State:/Users/ConsoleUser" | awk '/Name
&& ! /loginwindow/ { print $3 }' )
Everything else works fine in Ventura.