oceanbase.service文件如下:
[Unit]
Description=OceanBase Start
After=network.target
[Service]
Type=forking
ExecStart=/etc/systemd/system/ocean_start.sh
ExecStop=/opt/software/oceanbase-all-in-one/obd/usr/bin/obd cluster stop obtest
ExecReload=/opt/software/oceanbase-all-in-one/obd/usr/bin/obd cluster restart obtest
[Install]
WantedBy=multi-user.target
/etc/systemd/system/ocean_start.sh 文件如下:
#!/bin/bash
echo “Hello World!”
/opt/software/oceanbase-all-in-one/obd/usr/bin/obd cluster start obtest
执行命令如下:
sudo systemctl start oceanbase.service
报错如下:
Job for oceanbase.service failed because the control process exited with error code.
See “systemctl status oceanbase.service” and “journalctl -xeu oceanbase.service” for details.
wsw@wsw:~$ systemctl status oceanbase.service
× oceanbase.service - OceanBase Start
Loaded: loaded (/etc/systemd/system/oceanbase.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Wed 2024-07-24 14:25:32 CST; 11s ago
Process: 4089 ExecStart=/etc/systemd/system/ocean_start.sh (code=exited, status=127)
CPU: 1ms
7月 24 14:25:32 wsw systemd[1]: Starting OceanBase Start…
7月 24 14:25:32 wsw ocean_start.sh[4089]: [41B blob data]
7月 24 14:25:32 wsw systemd[1]: oceanbase.service: Control process exited, code=exited, status=127/n/a
7月 24 14:25:32 wsw systemd[1]: oceanbase.service: Failed with result ‘exit-code’.
7月 24 14:25:32 wsw systemd[1]: Failed to start OceanBase Start.