Push-Nachrichten von MacTechNews.de
Würden Sie gerne aktuelle Nachrichten aus der Apple-Welt direkt über Push-Nachrichten erhalten?
Forum>Software>Software-Aktualisierung automatisieren und vor Neustart warnen

Software-Aktualisierung automatisieren und vor Neustart warnen

julesdiangelo
julesdiangelo22.06.0711:49
Hallo,

ich möchte auf "meinen" 50 Macs die Softwareaktualisierung so automatisieren, dass sie automatisch 1-2 mal am Tag nach Updates sucht, diese installiert, und wenn ein Neustart erforderlich ist, ein Fenster anzeigt welches den User zum Neustart auffordert. Dieses Fenster sollte man natürlich nicht schließen können.

Gibt es dafür schon vorgefertigte Scripte, die ich nur noch in die cron eintragen muss, oder hat jemand eine bessere/andere Idee.

Viele Grüße
Jules
„bin paranoid, wer noch?“
0

Kommentare

julesdiangelo
julesdiangelo22.06.0714:19
Selbst ist der Admin. Habe dann mal etwas angepasst, was ich noch in irgendeinem Google-Cache gefunden habe:




#!/bin/sh

################
#
# Software Update Service
# Revision 2004041903
#
# created by jlevitsk@joshie.com ( www.foist.org )
# idea from tim.bounds@duke.edu
#
#
#################

# Anacron kicks off daily scripts 5 minutes in so probably we are plugged in by now to ether or wifi
# now let us see that it is a most likely fast connection this would suck over dialup.
#
echo "SUS: Checking for connectivity to check for updates..."

# pause for 1 minute to account for job running when laptop is waking up.
# AirPort cards are sometimes bad at kicking in super-quick so we'll be safe
# and add a delay.
sleep 5

en0status=`ifconfig en0 | /usr/bin/awk '/status: active/ {print $1}'`
en1status=`ifconfig en1 | /usr/bin/awk '/status: active/ {print $1}'`

if [ $en0status ] || [ $en1status ]; then
# This will test for reliable connectivity for 10 minutes more or less
N=0
while [ "$N" -le "60" ] && [ "$network" != "Reachable" ]; do
N=$[N+1]
network=`/usr/sbin/scutil -r wwwmath1.uni-muenster.de`
sleep 10
done

if [ $N -gt "59" ] ; then
echo "SUS: en0 or en1 was active but there was not a reliable connection. Aborting."
exit 1
fi

# Ab hier geänderter Teil. Nun werden nicht mehr ausgewählte, sondern alle Updates installiert, und danach der User zum Neustart aufgefordert, bzw. ein Reboot durchgeführt.

echo "SUS: Fetching available update list from Apple."
NeedUpdates=0
availupdates=`/usr/sbin/softwareupdate -l`
j=`echo "$availupdates" | grep "Software Update found the following new or updated software:"`
if [ "$j" != "" ] ; then
NeedUpdates=1
fi

if [ $NeedUpdates = 0 ] ; then
echo "SUS: No updates are needed. Exiting for now."
exit 0
else
echo "SUS: We need updates. Will attempt them now."
fi

# Switch to hide the EULA stuff
COMMAND_LINE_INSTALL=1 export COMMAND_LINE_INSTALL

# This will grab the update file and install
echo "SUS: Attempting to apply approved needed updates."
updstatus=`/usr/sbin/softwareupdate -ia 2>/dev/null | awk '/restart immediately/ {print $1}'`

# Now we call the reboot script which will reboot if nobody is signed on.
# We check to see if softwareupdate thinks a reboot is needed. If it doesn't then
# there is no point in rebooting
#
if [ $updstatus ]; then
if [ "`/usr/bin/who | /usr/bin/grep console | /usr/bin/awk '{ print $2 }'`" == "console" ]; then
/usr/bin/osascript -e 'tell app "Finder" to activate' \
-e 'tell app "Finder" to display dialog "Hinweis: Updates wurden automatisch installiert. Bitte starten Sie Ihren Rechner umgehend neu." buttons ["Ok"] with icon caution'
echo "SUS: A reboot is required but the user is signed in. Told user to reboot."
else
echo "SUS: A reboot is required. Attempting to reboot."
/sbin/shutdown -r now "Restarting after applying security updates."
fi
fi

echo "SUS: Process completed properly."
exit 0
fi

echo "SUS: Neither en0 nor en1 were available. Aborting."
exit 1
„bin paranoid, wer noch?“
0

Kommentieren

Diese Diskussion ist bereits mehr als 3 Monate alt und kann daher nicht mehr kommentiert werden.