gpt4 book ai didi

java - 使用 install4j 以 root 身份启动服务

转载 作者:行者123 更新时间:2023-11-30 06:22:51 32 4
gpt4 key购买 nike

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

最佳答案

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

关于java - 使用 install4j 以 root 身份启动服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18847421/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com