Posted on 11-20-2018 06:09 PM
i have set ScreenSave for current with script , but all user logout the screensave become the system screensave picture.it's not satisfy our customers' requirements.
this shell just set screensave when user login ,when not login the screensave is also show system screensave.
please help me ! Advance thanks.
#!/bin/sh
if [ ! -d "/Library/Screen Savers/Default Collections/OPPO/" ];then
echo "ERROR: Directory does not exists. Exiting"
exit 1
fi
#delete old ScreenSave images
lines=`find /Library/Screen Savers/Default Collections/OPPO -mtime +1 | wc -l`
for (( i = 0; i < $lines; i++ )); do
find /Library/Screen Savers/Default Collections/OPPO -mtime +1 | tail -n 1 | sed 's/ /\ /g' | xargs rm -rf
done
currentUser=`ls -l /dev/console | cut -d " " -f 4`
# grab the system's uuid
if [[ `ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-50` != "00000000-0000-1000-8000-" ]]; then
macUUID=`ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-62`
fi
#jamf displayMessage -message $currentUser
defaults write /Users/$currentUser/Library/Preferences/ByHost/com.apple.screensaver.$macUUID.plist CleanExit "YES"
defaults write /Users/$currentUser/Library/Preferences/ByHost/com.apple.screensaver.$macUUID.plist PrefsVersion -int 100
defaults write /Users/$currentUser/Library/Preferences/ByHost/com.apple.screensaver.$macUUID.plist idleTime -int 600
defaults write /Users/$currentUser/Library/Preferences/ByHost/com.apple.screensaver.$macUUID.plist moduleDict -dict moduleName "iLifeSlideshows" path "/System/Library/Frameworks/ScreenSaver.framework/Resources/iLifeSlideshows.saver" type -int 0
defaults write /Users/$currentUser/Library/Preferences/ByHost/com.apple.screensaver.$macUUID.plist tokenRemovalAction -int 0
defaults write /Users/$currentUser/Library/Preferences/ByHost/com.apple.ScreenSaverPhotoChooser.$macUUID.plist LastViewedPhotoPath ""
defaults write /Users/$currentUser/Library/Preferences/ByHost/com.apple.ScreenSaverPhotoChooser.$macUUID.plist SelectedFolderPath "/Library/Screen Savers/Default Collections/OPPO"
defaults write /Users/$currentUser/Library/Preferences/ByHost/com.apple.ScreenSaverPhotoChooser.$macUUID.plist SelectedSource -int 3
defaults write /Users/$currentUser/Library/Preferences/ByHost/com.apple.ScreenSaver.iLifeSlideShows.$macUUID styleKey "KenBurns"
chown $currentUser /Users/$currentUser/Library/Preferences/ByHost/com.apple.screensaver.$macUUID.plist
chown $currentUser /Users/$currentUser/Library/Preferences/ByHost/com.apple.ScreenSaverPhotoChooser.$macUUID.plist
chmod 700 /Users/$currentUser/Library/Preferences/ByHost/com.apple.screensaver.$macUUID.plist
chmod 700 /Users/$currentUser/Library/Preferences/ByHost/com.apple.ScreenSaverPhotoChooser.$macUUID.plist
killall cfprefsd
Posted on 11-21-2018 06:38 AM