iServer-Linux环境下开机自启动实现
备注:该方案的前提是linux环境下已经安装部署好了iServer
1、在/etc/init.d/目录下创建iserver服务脚本文件。
[root@localhost /]# vim /etc/init.d/iserver [root@localhost /]# cat /etc/init.d/iserver
2、在上面创建好的iserver文件中编写脚本
#!/bin/bash
#
#chkconfig:345 99 10
#description: StartupScriptforSupermapiServer
export ISERVER_HOME=/opt/supermap_iserver_811_16806_137_linux64_deploy
case "$1" in
 start)
                echo "-----startup iserver-----"
                sh $ISERVER_HOME/bin/startup.sh
                echo "-----startup iserver successful-----"
                ;;
        stop)
                echo "-----shutdown iserver-----"
                sh $ISERVER_HOME/bin/shutdown.sh
                echo "-----shutdown iserver successful-----"
                ;;
        restart)
                echo "-----restart iserver-----"
                sh $ISERVER_HOME/bin/shutdown.sh
                sh $ISERVER_HOME/bin/startup.sh
                echo "-----restart iserver successful-----"
                ;;
        *)
                echo 'Usage:iserver start|stop|restart'
                ;;
        esac
3、赋权限,测试启动脚本
[root@localhost /]# cd /etc/init.d/ [root@localhost init.d]# chmod 755 iserver #赋予权限 [root@localhost init.d]# service iserver start #启动服务 Starting iserver (via systemctl): [ 确定 ] [root@localhost init.d]# service iserver stop #停止服务 Stopping iserver (via systemctl): [ 确定 ] [root@localhost init.d]# service iserver restart #重启服务 Restarting iserver (via systemctl): [ 确定 ]
4、将该脚本加入到系统启动队列
[root@localhost zm]# chkconfig iserver on #服务脚本加入到系统启动队列 [root@localhost zm]# chkconfig --list iserver #检查 iserver服务是否已经生效
5、重启linux机器
[root@localhost zm]# reboot #重启linux
6、浏览器输入iserver服务地址测试成功,如下:
 
 
                     
                    
                 
                    
                 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号