1.使用shell脚本直接注册服务启停脚本,实现开机自启动:
注册的shell 脚本dm_service_installer.sh在DM_HOME/script/root目录下
[root@localhost root]$ pwd
/dm/dmdbms/script/root
[root@localhost root]$ ls
dm_service_installer.sh dm_service_uninstaller.sh root_installer.sh
[root@localhost root]$
注意:执行此脚本一定要使用root用户权限
2.通过指定服务类型注册服务
[root@dm2 root]# pwd
/dm/dmdbms/script/root
[root@dm2 root]# ls
dm_service_installer.sh dm_service_uninstaller.sh root_installer.sh
[root@dm2 root]# ./dm_service_installer.sh -t dmserver -i /dm/dmdbms/data/cndba/dm.ini -p DM
Move the service script file(/dm/dmdbms/bin/DmServiceDM to /etc/rc.d/init.d/DmServiceDM )
Finished to create the service (DmServiceDM )
[root@dm2 root]#
[root@dm2 root]# ll /etc/rc.d/init.d/DmServiceDM
-rwxr-xr-x 1 root root 12394 Feb 28 16:15 /etc/rc.d/init.d/DmServiceDM
[root@dm2 root]#
3.测试注册脚本是是否可以正常启停
[root@dm2 root]$ service DmServiceDM status
DmServiceDM is stopped
[root@dm2 root]$ service DmServiceDM start
Starting DmServiceDM: [ OK ]
[root@dm2 root]$ service DmServiceDM status
DmServiceDM (pid 3556) is running...
[root@dm2 root]$ service DmServiceDM stop
Stopping DmServiceDM: [ OK ]
[root@dm2 root]$ service DmServiceDM status
DmServiceDM is stopped
[root@dm2 root]$
后台启停脚本注册成功。
注意:
在DM8中注册命令有一些改动,“i”参数取消了,替换为 “dm_ini”此类参数,详细信息通过 ./dm_service_installer.sh -h查看。