Hey all,
Long time no post!
I got a Bash script and got a snag I can't figure out.
There is a .command file that can be launched (either double clicking or called from Terminal) named CheckForUpdatesNow.command
Pending on a few a things, this file can be located either:
/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Resources/CheckForUpdatesNow.command
or
~/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Resources/CheckForUpdatesNow.command
or
Doesn't exist (provided Google Chrome has never been launched)
Ideally, would like to run a weekly policy that updates all our Google Apps at log out by targeting this command.
So I made a script (below) that works, however, if the above .command file is in ~/Library/ then the script hangs and hangs and hangs.
Otherwise, it works.
Really have no idea why it hangs in the user space.
Any thoughts?
Thanks in advance as always
-pat
#!/bin/sh -x
#Capture the logged in user
consoleUser=`ls -la /dev/console | cut -d " " -f 4`
#the variable of the user path
userPath=/Users/$consoleUser
#Locations of the Google Update Agent can be either root or user based
gooUpdateRootAgent=/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Resources/CheckForUpdatesNow.command
gooUpdateUserAgent=$userPath/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Resources/CheckForUpdatesNow.command
if [ -f $gooUpdateRootAgent ];
then
sudo -u $consoleUser $gooUpdateRootAgent
elif [ -f $gooUpdateUserAgent ];
then
sudo -u $consoleUser $gooUpdateUserAgent
else
echo "Google Chrome has never been launched on this machine"
fi