solaris\linux下建系统任务执行shell脚本_VMware, Unix及操作系统讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  VMware, Unix及操作系统讨论区 »
总帖数
2
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 2293 | 回复: 1   主题: solaris\linux下建系统任务执行shell脚本        下一篇 
John
注册用户
等级:大元帅
经验:90444
发帖:136
精华:2
注册:2011-7-21
状态:离线
发送短消息息给John 加好友    发送短消息息给John 发消息
发表于: IP:您无权察看 2015-6-30 16:13:56 | [全部帖] [楼主帖] 楼主

linux系统下:
1、建存放脚本的目录,如:

[oracle@localhost]$mkdir /home/oracle/bin


2、修改系统环境变量文件中的PATH变量,加上/home/oracle/bin目录

[oracle@localhost]$vi .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin:/home/oracle/bin
export PATH
unset USERNAME
------


应用环境变量:

[oracle@localhost]source .bash_profile


也可直接用export定义变量:

[oracle@localhost]$export PATH=$PATH:/home/oracle/bin


3、在/home/oracle/bin目录创建shell脚本exp_user.sh

[oracle@localhost]$ cat > exp_user.sh
exp system/oracle owner=user1 file=/oradata/user1.dmp
Ctrl+C


4、给脚本赋执行权限:

[oracle@localhost]$chmod u+x exp_user.sh


5、创建执行作业计划脚本:

[oracle@localhost]$cat > cronfile
0 1 * * * /home/oracle/bin/exp_user.sh


6、提交作业:

[oracle@localhost]$crontab cronfile
[oracle@localhost]$crontab -l
0 1 * * * /home/oracle/bin/exp_user.sh


solaris系统下:
1、与linux相同

2、开始的修改vi .profile(注意solaris环境变量文件名是.profile,用ls -a命令可以看隐藏文件)是相同的,但是不能用source .profile命令应用文件中变量,要执行下面的操作:
注意:Solaris的sh不支持export PATH=$PATH:/home/oracle/bin这样的写法配置环境变量,需要改为两行: 

[oracle@localhost]$PATH=$PATH:/home/oracle/bin
[oracle@localhost]$export PATH


下面的步骤3、4、5、6就跟linux相同了.

--转自 北京联动北方科技有限公司




赞(0)    操作        顶端 
wei.yang
注册用户
等级:少校
经验:1172
发帖:26
精华:0
注册:1970-1-1
状态:离线
发送短消息息给wei.yang 加好友    发送短消息息给wei.yang 发消息
发表于: IP:您无权察看 2015-7-1 8:33:36 | [全部帖] [楼主帖] 2  楼

谢谢分享!挽



赞(0)    操作        顶端 
总帖数
2
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论