0 / 0
Go back to the English version of the documentation
在 "Linux上添加 systemctl 服务,自动启动Data Virtualization远程代理
Last updated: 2024年11月26日
在Linux上添加 systemctl 服务,自动启动Data Virtualization远程代理

通过将远程代理程序配置为系统服务,在操作系统重新启动时自动启动该远程代理程序。

关于本任务

systemctl 进程管理器是 Linux® 上的标准进程管理器,用于在系统重新启动时管理服务启动。 以下步骤假定您正在使用 systemctl。 如果您正在使用其他进程管理器,那么可能需要更改路径和命令。
注意:示例中IBMJava 和Data Virtualization远程代理的安装前缀为 "/home/<Operating system user>/wqAgent

过程

  1. 以 root 用户身份运行以下命令以启用 systemctl的用户进程。 输入操作系统用户的名称。
    loginctl enable-linger <Operating system user>
    
  2. 作为运行服务的系统用户,请完成以下步骤。
    1. 运行以下命令以创建 systemctl的目录:
      mkdir -p ${HOME}/.config/systemd/user/
    2. 创建具有以下内容的文件,并对正在进行的系统管理使用有意义的文件名和描述。
    .config/systemd/user/wqAgent.service例如:
    Description=Start Data Virtualization Remote Agent at Boot
    After=network.target
    [Service]
    Type=simple
    user=<Operating system user>
    WorkingDirectory=/home/<Operating system user>/wqAgent
    ExecStart=/home/<Operating system user>/wqAgent/datavirtualization_start.sh
    TimeoutStartSec=0
    [Install]
    WantedBy=default.target
  3. 运行以下命令以启用服务:
    systemctl --user enable wqAgent 
  4. 运行以下命令以启动服务:
    systemctl --user start wqAgent
  5. 运行以下命令以验证服务是否正在运行:
    ps -axf | grep DATAVIRTUALIZATION | grep -v grep | wc -l
    
    如果您正在运行一个远程连接器,那么此命令将返回值 1。 如果您正在运行多个远程连接器,那么返回的值将更大。
  6. To validate and view that the Remote Agent is running, navigate to the 数据来源 page from the Data Virtualization web client. 每个已连接的远程连接器都显示在新行上。