Jamf Scripting 101 + 201

Commands; More than 1,000 that can be called from terminal and or scripts

/bin
/sbin
/usr/bin
/usr/sbin

3rd Party tools
/usr/local/bin/jamf

Begin Script with She-Bang
(!#)

Variables are fill-in the blanks; placeholders for information that will come later

Conditionals, If/Then Statements – Decision Makers

Gist Here

#!/bin/bash
# Set directories
plex_media_folder="/Users/Teddy/Desktop/Plex Media"
movies_folder="/Users/Teddy/Movies"
# Find and remove .ts files older than 7 days
find "${plex_media_folder}" -type f -name "*.ts" -mtime +7 -exec rm {} \;
find "${movies_folder}" -type f -name "*.ts" -mtime +7 -exec rm {} \;
echo "Old Plex media files removed successfully."
# This empty's the trash can
osascript -e 'tell application "Finder" to empty the trash'

EOF

Scripting 201 Gists

Link
https://youtu.be/UQs7-N2_35k

Scripts Used in Webinar
https://github.com/jamf/Scripting-101-Webinar

Jam Pro Scripting 201 Video

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *