
Hi, I've been using AuthorizationMBS with success in some areas, but I've noticed that a command I'm running doesn't run. Code is similar to this: dim a as new authorizationMBS if a.SimpleNewAuthorization then a.execute("/bin/launchctl",array("unload","/Library/LaunchDaemons/com.bodoni.server.plist") if a.lasterror<>0 then break end if Although there's no error shown, the service does not stop. This works from the terminal: sudo launchctl unload Library/LaunchDaemons/com.bodoni.server.plist I can't see anything in the console log that might suggest what's wrong. This is from the console log. AuthorizationExecuteWithPrivileges and AuthorizationExecuteWithPrivilegesExternalForm are deprecated and functionality will be removed soon - please update your application I've tried a couple of variations, with and without /bin in the path and various launchctl subcommands such as disable, kill. Regards, Lee

Am 07.12.2023 um 12:07 schrieb Lee Badham via MBS Xojo Plugins
: Although there's no error shown, the service does not stop.
Could you maybe look like our example: if a.LastError<>0 then MsgBox "Lasterror on Execute: "+str(a.LastError) else e=a.Wait // wait for process to terminate. Returns PID if a.LastError<>0 then MsgBox "Lasterror on Wait: "+str(a.LastError) end if end if msgbox a.ReadStream(1024) So you would read the error message from the stream after it finished?
This is from the console log.
AuthorizationExecuteWithPrivileges and AuthorizationExecuteWithPrivilegesExternalForm are deprecated and functionality will be removed soon - please update your application
Yes, Apple loves you to use helper apps for this. See SMAppServiceMBS class. Best regards, Christian -- Read our blog about news on our plugins: http://www.mbsplugins.de/

Hi Christian, Thanks for your reply. a.lasterror is 0 a.readstream is empty When I try from the command line there's no output either, so I'm not sure readstream would have anything in it. When I try /bin/launchctl print com.bodoni.server, it all works. a.lasterror is 0, a.readstream has the same output as when I use a terminal. print can be used to see if a launchdaemon is running. So it looks like everything is working, but the service does not stop. We have to stop a few services using this method. 1 is a consoleapp, 1 is an old API1 webserver app, 1 is a newer API2 webserver app, so I don't think the style makes any difference. If I stop the services from the terminal using the same command, running /bin/launchctl load system/com.bodoni.server from AuthorizationMBS starts the service properly. Regards, Lee
On 7 Dec 2023, at 12:20, Christian Schmitz via MBS Xojo Plugins
wrote: Am 07.12.2023 um 12:07 schrieb Lee Badham via MBS Xojo Plugins
: Although there's no error shown, the service does not stop.
Could you maybe look like our example:
if a.LastError<>0 then MsgBox "Lasterror on Execute: "+str(a.LastError) else e=a.Wait // wait for process to terminate. Returns PID if a.LastError<>0 then MsgBox "Lasterror on Wait: "+str(a.LastError) end if end if msgbox a.ReadStream(1024)
So you would read the error message from the stream after it finished?
This is from the console log.
AuthorizationExecuteWithPrivileges and AuthorizationExecuteWithPrivilegesExternalForm are deprecated and functionality will be removed soon - please update your application
Yes, Apple loves you to use helper apps for this.
See SMAppServiceMBS class.
Best regards, Christian
-- Read our blog about news on our plugins:
_______________________________________________ MBS Xojo Plugins mailing list -- mbsxojoplugins@lists.monkeybreadsoftware.com To unsubscribe send an email to mbsxojoplugins-leave@lists.monkeybreadsoftware.com
participants (2)
-
Christian Schmitz
-
Lee Badham