编辑计划任务并执行

在日常的数据库管理当中,自动化地执行一些数据库日常管理的任务是
必不可少的,这就需要我们进行一下计划任务,编写到用户的计划任务当中。
以下是一个计划任务编辑并执行效果认证的的例子:

--- 计划任务:

--计划任务:每个3分钟将/home/home.text中的内容写到/home/oracle/orahome.text中:

[oracle@su ~]$ pwd

/home/oracle

[oracle@su ~]$ touch orahome.text

[oracle@su ~]$ cat orahome.text

[oracle@su ~]$

 

---查看/home/home.text的内容:

[oracle@su home]$ cat home.text

my heart will go on and on

HELLO,MYHOME     #脦碌募脪脮

hello,myhome!

[oracle@su home]$

 

---查看计划任务:

[oracle@su ~]$

[oracle@su ~]$ crontab -l

*/3 * * * * /bin/cat /home/home.text>>/home/oracle/orahome.text

 

--查看时间:

[oracle@su ~]$ date

Wed Nov  9 22:23:56 CST 2016

 

--等到22:30分的时候,查看文件orahome.text的内容:

[oracle@su ~]$ date

Wed Nov  9 22:32:11 CST 2016

#时间已经到。

---查看文件orahome.text的内容。

[oracle@su ~]$

[oracle@su ~]$ cat orahome.text

my heart will go on and on

HELLO,MYHOME     #脦碌募脪脮

hello,myhome!

my heart will go on and on

HELLO,MYHOME     #脦碌募脪脮

hello,myhome!

my heart will go on and on

HELLO,MYHOME     #脦碌募脪脮

hello,myhome!

[oracle@su ~]$

#可知已经写了3次了

可以看到,计划任务执行完毕。
这些任务都能在系统的后台进行中执行,达到自动化的效果。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31392094/viewspace-2128209/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/31392094/viewspace-2128209/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值