我正在使用Install4j为我们的Java应用程序创建OS X安装程序。安装程序设置为安装服务,然后启动它。它会执行此操作,但是它将以当前用户而不是root用户的身份运行服务。重启后,该服务将以root身份运行(因为它已作为LaunchDaemon安装)。首次启动安装程序时,如何设置它以root身份运行?
更新1:在“安装服务”之后添加“启动服务”操作后,我从日志中获得以下信息:
> [INFO]
> com.install4j.runtime.beans.actions.services.InstallServiceAction [ID
> 67]: Execute action
> Property description:
> Property installedServices: []
> Property serviceName: null
> Property executable: null
> Property launcherId: 57
> Property accountNameOrSid:
> Property macosIdentifier: com.degoo.backgroundService
> Property password: [logging of password is disabled]
> Property serviceAccount: Local System
> Property windowsArguments:
> Property windowsDependencies:
> Property windowsPriority: Normal
> Property autoStart: true
> Property interactive: false
> Property keepCurrentAccount: false
> Property restartOnFailure: true
> Property persistentProperties: {}
> Property rollbackSupported: true
> Execute action successful after 21 ms [INFO] com.install4j.runtime.beans.actions.services.StartServiceAction [ID
> 223]: Execute action
> Property autostartOnly: false
> Property serviceName: null
> Property executable: null
> Property launcherId: 57
> Property rollbackSupported: true
> usedExecutable: /Applications/Degoo/DegooBackgroundService
> SUID elevation: true, true
>
> ERROR] com.install4j.runtime.installer.helper.launching.LaunchHelper:
> return value is 126 [ERROR]
> com.install4j.runtime.beans.actions.services.StartServiceAction [ID
> 223]: Execute action not successful after 519 ms [INFO]
> com.install4j.runtime.beans.screens.InstallationScreen [ID 8]:
> Rollback barrier reached
> command: move 1 screens, executing actions, checking condition [INFO] com.install4j.runtime.beans.screens.FinishedScreen [ID 12]:
> Show screen [INFO] com.install4j.runtime.beans.screens.FinishedScreen
> [ID 12]: command: finish
> cleaning up
> Finished
在“安装服务”操作之后使用“启动服务”操作,而不是直接执行启动器。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句