一, 报错信息
二, 原因分析
因为 RHEL 7 使用 systemd 而不是 initd 运行进程和重启进程, 而 root.sh 通过传统的 initd 运行 ohasd 进程
三, 解决办法
在 RHEL 7 中 ohasd 需要被设置为一个服务, 在运行脚本 root.sh 之前.
1, 以 root 用户创建服务文件
- touch /usr/lib/systemd/system/ohas.service
- chmod 777 /usr/lib/systemd/system/ohas.service
将以下内容添加到新创建的 ohas.service 文件中
- vi /usr/lib/systemd/system/ohas.service
- [Unit]
- Description=Oracle High Availability Services
- After=syslog.target
- [Service]
- ExecStart=/etc/init.d/init.ohasd run>/dev/null 2>&1 Type=simple
- Restart=always
- [Install]
- WantedBy=multi-user.target
以 root 用户运行下面的命令
- systemctl daemon-reload
- systemctl enable ohas.service
- systemctl start ohas.service
2, 验证
systemctl status ohas.service
停止运行 root.sh 脚本后再进行该操作, 然后运行 root.sh 脚本
来源: http://www.linuxidc.com/Linux/2019-08/160063.htm