LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1081|回复: 3

如何在rc.local中执行自己写的环境变量文件!

[复制链接]
发表于 2006-5-16 14:29:27 | 显示全部楼层 |阅读模式
在redhatAS下安装了oracle10g和oracleAS10g分别设置了自己的环境变量:.as_profile,.db_profile,我想在开机时自动加载.db_profile然后执行lsnrctl和dbstart使oracledatabase10g自动启动,请问如何在/etc/rc.d/rc.local中加载自己写的.db_profile,谢谢!
注:.db_profile中定义了$ORACLE_HOME,$ORACHE_BASE,$ORACLE_SID等环境变量!
发表于 2006-5-16 14:53:06 | 显示全部楼层
是用chmod给这两个文件加上可执行的属性;
然后在rc.local文件中加入这两个文件的完整路径应该就可以了吧。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-5-16 14:56:31 | 显示全部楼层
source /home/oracle/.db_profile  或 su - oracle -c "source .db_profile"
su - oracle -c "/opt/oracle/product/10.1.0/bin/lsnrctl start"
su - oracle -c "/opt/oracle/product/10.1.0/bin/dbstart"
以上的写法好像都不行。lsnrctl执行不了,因为环境变量没有加载。
回复 支持 反对

使用道具 举报

发表于 2006-5-19 06:54:30 | 显示全部楼层
source /home/oracle/.db_profile 写入/etc/bashrc
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表