出于实际原因,可能需要在 Linux 服务器重启后自动启动 IRIS 实例。
下面是在 Linux 服务器重启时通过 systemd 自动启动 IRIS 的步骤:
1. 在 /etc/systemd/system/iris.service 中创建一个 iris.service 文件,其中包含以下信息
[Unit]
Description=InterSystems IRIS Data Platform
After=network.target
[Service]
Type=forking
User=irisusr
ExecStart=/usr/bin/iris start iris
ExecStop=/usr/bin/iris stop iris quietly
Restart=on-failure
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
DockerfileDockerfile
注意:User应该填入IRIS实例的所有者。
2. 重新加载 systemd 配置管理器
sudo systemctl daemon-reload
BashBash
3. 启用IRIS服务,使其自动启动
sudo systemctl enable iris
BashBash
激活后将创建软链接,自动启动 IRIS:
Synchronizing state of iris.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable iris
Created symlink /etc/systemd/system/multi-user.target.wants/iris.service → /etc/systemd/system/iris.service.
ObjectScriptObjectScript
4. 试着重启服务器
sudo reboot
ObjectScriptObjectScript
5. 查看IRIS实例是否自动启动
ssh guilbaud@192.168.102.130
guilbaud@192.168.102.130's password:
Welcome to Ubuntu 24.04 LTS (GNU/Linux 6.8.0-36-generic x86_64)
BashBash
$ iris all
Instance Name Version ID Port Directory
---------------- ---------------- ----- --------------------------------
up >IRIS 2024.1.0.267.2 1972 /usr/irissys
BashBash