Question

I plan to have a script run that will update our Macs with new Adobe licensing package/installer but I don't want it to run if the task has ran before.

I'd like to see a script that can check for a local file (ex. /Library/adobecc2018.txt) which would get placed at this location after re-serialization has been completed once. If the adobecc2018.txt file is not there the full script will run. If the adobecc2018.txt is there I want to the script to end and not go any further.

Also, I will have another .txt file sitting on a network share and I'd love to see the file get populated with the name of the computer once the script runs so we have a list of computers that we can look at to see which computers have been fixed and which have not.

I found the script I worked on last year but we didn't use it. So the first part of my question is answered but still need to figure out how to add text into a .txt. So example: /share/adobeupdate.txt

I'd like to see something like this:

ComputerName-Date
ComputerName2-Date
ComputerName3-Date
ComputerName4-Date
ComputerName5-Date
etc.
#!/bin/bash

echo "Adobe Update Script"

####
#### If file /Library/Scripts/adobecc2018.txt DOES exist then exit
####
if [[ -f "/Library/adobecc2018.txt" ]] ; then
    echo '2018/19 Adobe Serialization Fix Already Applied - No more actions required'
    exit
fi


####
#### If file /Library/Scripts/adobecc2018.txt does NOT exist continue script
####
if [ ! -e "/Library/adobecc2018.txt" ]; then
    echo 'Adobe is using the OLD serial number - Now applying new 2018/19 Adobe Serialization'
#   touch /Volumes/shares/macscripts/adobecc2018_serialization_fix.command
    sudo touch /Library/adobecc2018.txt
    echo 'Adobe 2018/19 Serialization Completed'
fi

# Script End

exit 0  
Was it helpful?

Solution

According to your comment, then you would add this line in the condition that "serialize"'s the file if it doesn't exist.

printf '%s - %s\n' "$(scutil --get ComputerName)" "$(date)" >> /share/adobeupdate.txt
Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top