sybase的自启动控制脚本
cat>/etc/init.d/sybased<<#!/bin/bash#
# chkconfig: 2345 81 31
# description: sybase start&stop script
# Source function library.
. /etc/rc.d/init.d/functions
SYB_OWNER=sybaseSYBASE=/opt/sybaseSYBASE_ASE=ASE-15_0SYBASE_OCS=OCS-15_0SYBASEDIR=\$SYBASE/\$SYBASE_ASE/installSYB_STOP=\$SYBASE/\$SYBASE_OCS/binSAPASS=123456DSQUERY=testb2bjoyDATASERVER=testb2bjoyRETVAL=0PATH=\$SYBASE/\$SYBASE_ASE/bin:/\$SYBASE/\$SYBASE_ASE/install:/\$SYBASE/\$SYBASE_OCS/binPATHHOME/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/bin:.
export SYBASE DSQUERY SYBASE_ASE SYBASE_OCS DATASERVER SYBASEDIR PATH
if [ ! -f \$SYBASE/\$SYBASE_ASE/install/startserver ]thenecho "Sybase startup: startserver not found"exitfi
start(){su - \$SYB_OWNER -c "\$SYBASE/\$SYBASE_ASE/install/startserver -f \$SYBASEDIR/RUN_"\$DATASERVER""sleep 60su - \$SYB_OWNER -c "\$SYBASE/\$SYBASE_ASE/install/startserver -f \$SYBASEDIR/RUN_"\$DATASERVER"_bs"
RETVAL=\$?
if [ \$RETVAL -eq 0 ]; thenaction \$"Starting Sybase 12.5 startserver: " /bin/trueelseaction \$"Starting Sybase 12.5 startserver: " /bin/falsefi
return \$RETVAL}
stop(){
su - \$SYB_OWNER -c "isql -Usa -P\$SAPASS -S\$DATASERVER -i\$SYBASE/\$SYBASE_ASE/install/shutdown_backup.sql"su - \$SYB_OWNER -c "isql -Usa -P\$SAPASS -S\$DATASERVER -i\$SYBASE/\$SYBASE_ASE/install/shutdown_dataserver.sql"
RETVAL=\$?
if [ \$RETVAL -eq 0 ]; thenaction \$"Stopping Sybase 12.5 sybshutdown: " /bin/trueelseaction \$"Stopping Sybase 12.5 sybshutdown: " /bin/falseRETVAL=1fi
return \$RETVAL}
restart(){stopstart}
pid="dataserver"
case "\$1" instart)startRETVAL=\$?;;stop)stopRETVAL=\$?;;status)
su - sybase -c "/opt/sybase/ASE-15_0/install/showserver"RETVAL=\$?
;;restart)restartRETVAL=\$?;;*)echo \$"Usage: \$0 {start|status|stop|restart}"exit 1esac
exit \$RETVALEOFchmod 755 /etc/init.d/sybasedchkconfig add sybasedchkconfig --list |grep sybased
none