ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 编辑计划任务并执行

编辑计划任务并执行

原创 Linux操作系统 作者:skyin_1603 时间:2016-11-10 00:49:10 0 删除 编辑
在日常的数据库管理当中,自动化地执行一些数据库日常管理的任务是
必不可少的,这就需要我们进行一下计划任务,编写到用户的计划任务当中。
以下是一个计划任务编辑并执行效果认证的的例子:

---计划任务:

--计划任务:每个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博客 ” ,链接:https://blog.itpub.net/31392094/viewspace-2128209/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2016-09-06

  • 博文量
    231
  • 访问量
    215168