当前位置: 首页 > BASIC > 正文

下面是在solaris 11.2环境中测试oswbb随系统自动启动,不同环境需要更改一下OSW的目录

root@solaris:~# cat /etc/init.d/osw.sh

########################################################################

# Establish default values

########################################################################

# Set OSW_HOME to the directory where your OSWatcher tools are installed

OSW_HOME=/export/home/oracle/oswbb

# Set OSW_INTERVAL to the number of seconds between collections

OSW_INTERVAL=30

# Set OSW_RETENTION to the number of hours logs are to be retained

OSW_RETENTION=48

# Set OSW_COMPRESSION to the desired compression scheme

OSW_COMPRESSION=gzip

# Set OSW_ARCHIVE where the logs should be stored

OSW_ARCHIVE=$OSW_HOME/archive

########################################################################

 

echo $OSW_HOME

echo "******************************************************" >> $OSW_HOME/init_osw.log

case $1 in

‘start’)

echo "…Starting OSWBB from init at `date` " >> $OSW_HOME/init_osw.log

cd $OSW_HOME

./startOSWbb.sh "${OSW_INTERVAL}" "${OSW_RETENTION}" "${OSW_COMPRESSION}" "${OSW_ARCHIVE}"

;;

‘stop’)

echo "…Stopping OSWBB from init at `date` " >> $OSW_HOME/init_osw.log

cd $OSW_HOME

./stopOSWbb.sh

;;

*)

echo "Usage: $0 start|stop" >&2

exit 1

;;

esac

exit 0

给执行权限,并增加到/etc/inittab

chmod +x /etc/init.d/osw.sh start

echo "osw:3:respawn:/etc/init.d/osw.sh start >/dev/null 2>&1 </dev/null" >>/etc/inittab

 

下面查询日志文件

root@solaris:/export/home/oracle/oswbb# tail -f init_osw.log

******************************************************

…Starting OSWBB from init at Friday, January 23, 2015 02:31:11 PM UTC

******************************************************

…Starting OSWBB from init at Friday, January 23, 2015 02:31:11 PM UTC

******************************************************

…Starting OSWBB from init at Friday, January 23, 2015 02:31:11 PM UTC

******************************************************

…Starting OSWBB from init at Friday, January 23, 2015 02:31:11 PM UTC

******************************************************

…Starting OSWBB from init at Friday, January 23, 2015 02:31:11 PM UTC

OSWBB随系统自动启动:等您坐沙发呢!

发表评论

gravatar

? razz sad evil ! smile oops grin eek shock ??? cool lol mad twisted roll wink idea arrow neutral cry mrgreen

快捷键:Ctrl+Enter