2

我正在使用 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
4

2 回答 2

3

在“安装服务”操作之后使用“启动服务”操作,而不是直接执行启动程序。

于 2013-09-17T12:21:34.843 回答
2

我发现了问题。我在操作树中的“安装”下方有“启动服务”操作。将其移至“已完成”下方后,它以 root 身份成功执行。

于 2013-09-17T14:37:54.790 回答