Deploying Updated Mac Dashboard and Technician pages (BESClientUI)

(imported topic written by SystemAdmin)

Greeting Everyone,

This is my first post here and I’m happy to be part of the community.

I’ve put some work into customizing the Mac _dashboard.html and _technician.html. I’m quite pleased with the final product. We’ve verified that the files copy. However, I’m not having luck restarting the agent via the Action.

Here’s the code below:

Action Script

Script Type BigFix Action Script

download http://BIGFIX.DOMAIN-NAME.COM:52311/Uploads/add327cac1c66cea426a30fc305003147fa003e1/__UISupport.tmp


continue if {(size of it = 37503 AND sha1 of it = "add327cac1c66cea426a30fc305003147fa003e1") of file "__UISupport.tmp" of folder "__Download"}


extract __UISupport.tmp


delete "{pathname of (file "__UISupport.tmp" of download folder)}"


parameter "DownloadDir" = "{pathname of (folder "__Download" of client folder of current site)}"


setting "_BESClient_ActionManager_TrayMode"="AlwaysTray" on "{parameter "action issue date" of action}" for client


setting "_BESClient_ActionManager_HasMainDialog"="1" on "{parameter "action issue date" of action}" for client


setting "_BESClient_ActionManager_InitialMainDialogWidth"="660" on "{parameter "action issue date" of action}" for client


setting "_BESClient_ActionManager_InitialMainDialogHeight"="1000" on "{parameter "action issue date" of action}" for client


parameter "BESDataDirMac" = "{pathname of parent folder of client folder of site "actionsite" & "/__UISupport"}"


setting "_BESClient_ActionManager_InitialUITab"="Dashboard" on "{parameter "action issue date" of action}" for client


folder delete "{parameter "BESDataDirMac"}"


folder create "{parameter "BESDataDirMac"}"


delete __createfile


createfile until END_UI_INSTALL_MAC


#!/bin/sh


cp -Rfp "{pathname of client folder of current site & "/__Download"}/__UISupport/*" "/Library/Application Support/BigFix/BES Agent/__BESData/__UISupport"


BESpid=$(ps -ax | grep BESClientUI | grep -v grep | awk '{print $1}')


if ; then


kill "$BESpid"


launchctl stop com.bigfix.BESAgent


launchctl start com.bigfix.BESAgent


fi


END_UI_INSTALL_MAC


wait chmod +x __createfile


delete ./installClientUI.sh


copy __createfile ./installClientUI.sh


run /bin/sh -c "trap '' 15; ./installClientUI.sh"

(imported comment written by SystemAdmin)

Found working solution to restart the agent:

if {((version of client > "7.1") AND (exists file "/Library/LaunchDaemons/BESAgentDaemon.plist") AND (system version >= "10.4"))}


appendfile /bin/launchctl unload /Library/LaunchDaemons/BESAgentDaemon.plist


appendfile sleep 5


appendfile /bin/launchctl load /Library/LaunchDaemons/BESAgentDaemon.plist


else


appendfile /sbin/SystemStarter stop BESAgent


appendfile sleep 5


appendfile /sbin/SystemStarter start BESAgent


endif

(imported comment written by SystemAdmin)

Though you have already figured it out, in 9.0 and above there is an even easier way with a new actionscript command:

client restart
1 Like