Self Service refresh/home via command line.


Is there a command line equivalent of clicking the home button in self service?

We have our apps in self service scoped to smart groups to only appear if they don't have them already. However after a users installs an app it still shows as available until they click them home button in self service.

Hoping to add a command to run at the end of the policy to refresh the self service window.



New Contributor II

You could have a script close Self Service and re-open it. Though I thought it already functions like you want it to. Do you have the policy set to update inventory? Do you have it set to Run Once or Ongoing? I witnessed this yesterday... I installed Java from Self Service and it disappeared after it was finished, though I will say it was already on the home page.

Legendary Contributor III

Command - R refreshes the page. If you can Applescript something to press those keys targeting the Self Service app that should do it. However, its been my experience as well that Self Service will auto refresh the main window once an installation finishes. Is that not actually happening in your environment?
Also, if you're policy scopes are based on Smart Groups based on inventory data, be sure you're running a recon (Update Inventory under Advanced) at the end.

New Contributor III

Hey - I needed to do this very thing today (sorry it's a year or so later :)!

The caveat is that it refreshes the window twice and will attempt to run Policy 0, but I don't think that exists on any JSS


#grep for Self Service if empty string then it is not running
#[Ss] regular expression trick keeps this grep from seeing itself in ps list
if [ -z "$(ps auxww | grep "[Ss]elf")" ]; then
echo "Self Service not open, exiting"

#get name of console owner
eval $(stat -s /dev/console)
consoleUsername=$(id -un $st_uid)

#run as console user
sudo su $consoleUsername -c "open selfservice://policy="

exit 0

You'll see this in /var/log/jamf.log:
Wed Nov 05 14:31:56 hostname jamf[]: Checking for policy ID 0...

url= has the same effect of trying to run Policy 0, there might be others but it's not documented I don't think

This is for some Self Service policies I have Limited to an IT LDAP group so we can log into Self Service and set the Department of a computer. So refreshing Self Service is needed once the department is set and Policies are then scoped...

Hope this helps you!