加入收藏 | 设为首页 | 会员中心 | 我要投稿 济南站长网 (https://www.0531zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

Linux中常见的例行性工作

发布时间:2016-09-10 08:22:54 所属栏目:Linux 来源:站长网
导读:一 、仅执行一次的工作调度单一工作排程的运作,那就是 at 这个指令的运作! 1.atd 启动与 at 运作的方式 [root@localhost ~]# /etc/init.d/atd restart Stoppi

一 、仅执行一次的工作调度单一工作排程的运作,那就是 at 这个指令的运作!

1.atd 启动与 at 运作的方式

[root@localhost ~]# /etc/init.d/atd restart

Stopping atd:                                              [ OK ]

Starting atd:                                              [ OK ]

2. 设置一下开机启动这个服务

[root@localhost ~]# chkconfig atd on

3.实际运行单一工作调度

《1》再过5分钟后,将/root/.basrc 寄给root自己

[root@localhost ~]# at now +5 minutes

at> /bin/mail root -s "testing at job" < /root/.bashrc

at> <EOT>        这里输入    ctrl +d 就会出现<EOT> 的字样.

job 7 at 2012-09-24 19:50

[root@localhost ~]# atq 查询目前主机上面有多少的at工件调度 如果关闭 atrm +工作号

6     2012-09-25 23:00 a root

7     2012-09-24 20:05 a root

[root@localhost ~]# at -c 6

#!/bin/sh

# atrun uid=0 gid=0

# mail     root 0

《2》将上述的第5项工作内容列出来查阅

如果在23:00停电关机命令如下

[root@localhost ~]# at 23:00 2012-9-25

at> /bin/sync

at> /bin/sync

at> /sbin/shutdown -h now

at> <EOT>

job 6 at 2012-09-25 23:00

事实上,当我们使用at时进入at shell 的环境让用户执行工作命令,你最好使用绝对路径来执行

8 .batch : 系统有空时才进行后台任务 ,他会在 CPU 工作负载小亍 0.8 的时候,才运行你所下达的工作任务

[root@localhost ~]# batch 23:00 2012-9-25

at> sync

at> sync

at> shutdown -h now

at> <EOT>    这里输入    ctrl +d 就会出现<EOT> 的字样.

job 8 at 2012-09-25 23:00

[root@localhost ~]# atq

6   2012-09-25 23:00 a root

8   2012-09-25 23:00 a root

查看本栏目更多精彩内容:http://www.bianceng.cn/OS/Linux/

(编辑:济南站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读