Jamf has provided a means to control their Self Service app by using URLs.
The client Mac that is enrolled in to Jamf and has the Jamf Self Service app installed would open a valid URL and this would trigger the Self Service app to perform the specified step. As mentioned in the above document, the URL for each Self Service app entry can be obtained in Jamf Pro by an administrator.
It is therefore possible to write a shell script which in turn opens such a URL, however the shell script needs to both run with SUDO privileges and still show as running by the logged in user, this is something probably familiar to most Jamf Pro admins but an example script which I know works for this is available as follows.
What the above script does not yet do is detect when the Jamf Self Service app has finished its task. I would like to do this so as to then quit the Self Service app when it finishes. (The process triggers unavoidably the launch of the Self Service app in order to do its task.)
Once approach might be to have a loop in the script which checks to see if the Apple installer is running and if it is not assumes then that Self Service has finished its install task, however I would tend to suspect this approach may not be sufficiently robust. So if anyone has any better suggestions they would be much appreciated.