badpage 发表于 2008-06-28 16:24

求助:不用文件怎么stop sybase

在程序中:
isql -Usa -P -S -i stop.sh


stop.sh:

shutdown

go


可stop sybase.

有没办法只执行sytem(isql -Usa -P -S -......................)不增加stop.sh就可stop sybase

[ 本帖最后由 badpage 于 2008-6-28 16:36 编辑 ]

zhaopingzi 发表于 2008-06-29 05:08

isql进去,shutdown

badpage 发表于 2008-06-30 17:47

已解决

#if 0
        #define _START_PATH_ "/sybase/sybase/ASE-12_5/install/"
        #ifndef __RESULT__
        #define __RESULT__
        int result;
        char ParamBuff;
        #endif
        sprintf(ParamBuff, "%s/startserver -f %s/RUN_%s", _START_PATH_,
                _START_PATH_, _SERVER_NAME_);
        result = system(ParamBuff);
        DEBUG_PRINT("start sybase param: \"%s\", result: %d\n",
                                        ParamBuff, result);
        //#endif
        sleep(10);
        #define _STOP_PATH_ "/sybase/sybase/OCS-12_5/bin/"
        #ifndef __RESULT__
        #define __RESULT__
        int result;
        char ParamBuff;
        #endif

        int fd;
        fd = open("stop.sql", O_CREAT|O_RDWR, S_IRWXU);
        if(fd == -1)
        {
                printf(" open stop.sqlfailed");
                return -1;
        }
        result = write(fd, "shutdown\ngo\n", sizeof("shutdown\ngo\n"));
        close(fd);
        if(result == -1)
        {
                printf("write stop.sql err\n");
                return -1;               
        }
        sprintf(ParamBuff, "%s/isql -U sa -P -S %s -i stop.sql", _STOP_PATH_,_SERVER_NAME_);
        result = system(ParamBuff);
        DEBUG_PRINT("start/stop sybase param: \"%s\", result: %d\n",
                                        ParamBuff, result);

        result = unlink("stop.sql");
        if(result == -1)
        {
                printf("unlink stop.sql err\n");
                return -1;               
        }
        //#endif
        #endif

[ 本帖最后由 badpage 于 2008-6-30 17:49 编辑 ]
页: [1]
查看完整版本: 求助:不用文件怎么stop sybase