配置 GBase 8t 自动启动服务 (脚本)
脚本用于 GBase 8t 服务(service) 的 启动/停止/重启/强制重启/状态查看:
可以使用service命令的方式 启动 和 关闭数据库:
[root@localhost etc]# service gbase8t stop
Shutdown GBase 8t SERVER gbaseserver . OK
[root@localhost etc]# service gbase8t start
Starting GBase 8t SERVER gbaseserver . OK
[root@localhost etc]# service gbase8t status
GBase 8t SERVER gbaseserver is running.
[root@localhost etc]#
#############################################
#!/bin/bash
# chkconfig: 2345 20 81
# chkconfig --add gbase8t --level 2345
# Description: GBase 8t service
使用方法:
1) 使用root用户将文件拷贝至目录 /etc/init.d/
2) 执行命令 chmod +x /etc/init.d/gbase8t
3) 执行命令 chkconfig --add gbase8t --level 2345
4) 按照实例信息修改脚本中的环境变量
语法: /etc/init.d/gbase8t {start|stop|restart|force-restart|status}
[root@localhost etc]# /etc/init.d/gbase8t
Usage: /etc/init.d/gbase8t {start|stop|restart|force-restart|status}
[root@localhost etc]# /etc/init.d/gbase8t stop
Shutdown GBase 8t SERVER gbaseserver . OK
[root@localhost etc]# /etc/init.d/gbase8t start
Starting GBase 8t SERVER gbaseserver . OK
[root@localhost etc]# /etc/init.d/gbase8t restart
Shutdown GBase 8t SERVER gbaseserver . OK
Starting GBase 8t SERVER gbaseserver . OK
[root@localhost etc]# /etc/init.d/gbase8t force-restart
Shutdown GBase 8t SERVER gbaseserver Force. OK
Starting GBase 8t SERVER gbaseserver . OK
[root@localhost etc]# /etc/init.d/gbase8t status
GBase 8t SERVER gbaseserver is running.
[root@localhost etc]# /etc/init.d/gbase8t stop
Shutdown GBase 8t SERVER gbaseserver . OK
[root@localhost etc]# /etc/init.d/gbase8t status
GBase 8t SERVER gbaseserver is NOT running.
[root@localhost etc]#