1 / 25

第 21 章 调度与网络

第 21 章 调度与网络. 内容概要. ◆ 使用 crontab 文件周期性调度任务的运行 ◆ 使用 at 命令调度一个或一系列任务在将来的某一时刻运行 ◆ 使用 batch 命令将任务调度到一个队列中,减少系统的瞬时负载。. 内容概要. ◆ 了解基本的网络术语 ◆ 为以太网和令牌环网配置 TCP/IP ◆ 使用一些标准的 TCP/IP 工具 ◆ 登录到其他系统 ◆ 传输文件 ◆ 运行命令. cron daemon. ◆ 负责运行被调度的任务 ◆ crontab 命令的事件 (有规律的调度任务)

mimis
Download Presentation

第 21 章 调度与网络

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 第21章 调度与网络

  2. 内容概要 ◆ 使用crontab文件周期性调度任务的运行 ◆ 使用at命令调度一个或一系列任务在将来的某一时刻运行 ◆ 使用batch命令将任务调度到一个队列中,减少系统的瞬时负载。

  3. 内容概要 ◆了解基本的网络术语 ◆为以太网和令牌环网配置TCP/IP ◆使用一些标准的TCP/IP工具 ◆登录到其他系统 ◆传输文件 ◆运行命令

  4. cron daemon ◆负责运行被调度的任务 ◆ crontab命令的事件 (有规律的调度任务) ◆ at命令的事件 (只在指定时刻执行一次) ◆ batch命令的事件 (在CPU的负载低的时候运行)

  5. crontab文件 ◆用于启动规律性的任务 ◆调度的内容在下面的文件中定义: /var/spool/cron/crontabs/ $USER ◆控制哪些用户可以使用crontab的权限文件: /var/adm/cron/cron.deny不能使用crontab的用户 /var/adm/cron/cron.allow出能够使用crontab的用户 ◆缺省情况下存在一个空的cron.deny ◆ cron.deny比cron.allow优先级高

  6. 系统日期和时间 $ crontab -l #0 3 * * * /usr/sbin/skulker #45 2 * * 0 /usr/lib/spell/compress … 0 11 * * * /usr/bin/errclear -d S,O 30 0 12 * * * /usr/bin/errclear -d H 90 0 15 * * * /usr/lib/ras/dumpcheck >/dev/null 2>&1 ◆ crontab文件的格式 分 时 日 月 周 命令

  7. 编辑crontab ◆ 编辑crontab文件 ◆ 比较安全的方式 # crontab -e # crontab -l > /tmp/crontmp # vi /tmp/crontmp # crontab /tmp/crontmp

  8. at和batch命令 at命令向cron提交只需执行一次的任务 # at now +2 mins banner hello > /dev/pts/0 <ctrl-d> job user.time.a will be run at date

  9. 控制at提交的任务 ◆列出at任务 at -I [ user ] atq [ user ] • # at –l • root.1118077769.a Mon Jun 6 10:09:29 2007 • root.1118078393.a Mon Jun 6 10:19:53 2007 • test2.1118079063.a Mon Jun 6 10:31:03 2007

  10. 控制at提交的任务 ◆取消一个任务 ◆ at -r job ◆ atrm [ job | user ] # at -r test2.1118079063.a at file: test2.1118079063.a deleted

  11. batch命令 • batch命令:当系统负载级别允许时运行作业 #batch banner hello > /dev/pts/0 <ctrl-d>

  12. 什么是TCP/IP ◆是 Transmission Control Protocol/Internet Protocol的 缩写,传输控制协议/互联网协议 ◆可以在不同网络类型的系统之间交换数据 ◆在网络互联的系统中实现数据传输的透明化 ◆ TCP/IP是与供货商无关的,是由“Internet Architecture Board”(Internet构架委员会)负责的。

  13. A gateway gateway Serial Token modem modem Ring C B D FDDI E gateway gateway X.25 F Ethernet Internet • ◆ 一个tcp/ip网络也叫一个internet • ◆单独的机器叫主机(hosts),这些主机的大小功能可能不同,但在TCP/IP网络上的身份是平等的。 • ◆把个两或多个物理网段互连起来的主机叫网关(gateways)。

  14. 名称和地址 ◆在TCP/IP网络中的每一个系统都被分配一个名字 例如:sys3 ◆在连接到另外一个系统的时候只需知道名称就可以了 例如:$telnet sys3 ◆在连接另外的系统和用户时需要知道系统名称和用户名称 例如:$mail fred@sys3 ◆每个系统可以有一个或多个TCP/IP地址 例如:10.0.0.3 ◆如果只知道地址而不知道名称,那么你可以通过地址来使用TCP/IP工具。

  15. Server Clients Network PC Disk storage File Transfer Management Printers Programs Mail Login Network Sessions System p System p Other Systems TCP/IP网络工具 • ◆ 标准的 TCP/IP 设备包括: 邮件, 文件传递, 远程登录, 远程执行, 和远程打印 • ◆ 一些AIX应用使用TCP/IP: • ◆ 网络文件系统(NFS) • ◆ 网络信息服务(NIS) • ◆ 域名系统(DNS) • ◆ 动态主机配置协议(DHCP) • ◆ 网络社区系统(NCS) • ◆ 分布计算环境(DCE) • ◆ X Windows 和 AIXWindows • ◆ Tivoli Netview for AIX

  16. 配置TCP/IP所需的信息 ◆地址 ◆分配一个唯一TCP/IP地址给一个网络适配器,通常还有一个子网掩码(Subnet Mask)。这些通常由网络管理员来分配。 ◆名称 每台机器都有一个唯一主机名(hostname) 每台机器必须能访问一个地址与名称之间转换的列表。可以是: /etc/hosts文件 域名服务器(DNS),此种情况必须知道域名和域名的地址。 ◆路由(route) 系统为了实现与其他网络上系统的通讯,必须能够找到通讯所需网关(gateway)。

  17. 配置TCP/IP Minimum Configuration & Startup ToDelete existing configuration data, please use FurtherConfiguration menus Type or select values in entry fields. Press Enter AFTER making all desired changes [Entry Fields] * HOSTNAME [sys1] * Internet ADDRESS (dotted decimal) [10.0.0.1] Network MASK (dotted decimal) [255.255.255.0] * Network INTERFACE en0 NAMESERVER Internet ADDRESS (dotted decimal) [] DOMAIN Name [] Default Gateway Address (dotted decimal or symbolic name) [10.0.0.192] Cost [0] # Do Active Dead Gateway Detection? no + Your CABLE Type N/A + START TCP/IP daemons Now no + F1=Help F2=Refresh F3=Cancel F4=List Esc+5=Reset Esc+6=Command Esc+7=Edit Esc+8=Image Esc+9=Shell Esc+0=Exit Enter=Do # smit mktcpip

  18. Flat名称解析 # more /etc/hosts # The format of this file is: # Internet Address Hostname # Comments # Items are separated by any number of blanks and/or tabs. A '#' # indicates the beginning of a comment; characters up to the end # of the line are not interpreted by routines which search this # file. Blank lines are allowed. #Internet Address Hostname #Comments 127.0.0.1 loopback localhost 10.0.0.1 sys1 timeserver 10.0.0.2 sys2 10.0.0.3 sys3 10.0.0.4 sys4

  19. 标识主机名称 ◆ hostname命令 ◆ host命令 • # hostname • sys3 # host sys3 sys3 is 10.0.0.3, Aliases: sys3.washington.ibm.com # host 10.0.0.3 sys3 is 10.0.0.3, Aliases: sys3.washington.ibm.com

  20. TCP/IP中的基本功能 下面的命令可以在TCP/IP环境中使用: ◆测试网络连接ping ◆文件传输ftp ◆远程登录telnet

  21. Ping命令 ◆ ping 192.168.12.251 PING 192.168.12.251:(192.168.12.251):56data bytes 64bytes from 192.168.12.251:icmp—seq=0 ttl=255 time=0ms 64bytes from 192.168.12.251:icmp—seq=1 ttl=255 time=0ms 64bytes from 192.168.12.251:icmp-seq=2 ttl=255 time=0ms … 3packets transmitted,3packets received,0%packets loss Round-trip min/avg/max=0/0/0ms

  22. 课堂练习 1.判断at.allow和at.deny文件必须都要做设置以控制用户对at的使用。 2.使用cron,怎样指定任务在每周四的每小时的10分和30分时执行? ______________________________________ 3.怎样设置myscript脚本从现在开始的10分钟后执行? ______________________________________

  23. 课堂练习 4. 这些命令可以实现什么功能? ◆ ftp:_________________________________ ◆ telnet:________________________________ 5. 主机和网关有什么区别? ____________________________________ 6. 判断TCP/IP网络中的每台主机都有唯一的主机名称和TCP/IP地址。 7. 在Flat网络中哪个文件保存了主机名称与ip地址之间的解析关系?_____________________________

  24. 课堂练习答案 1. 错误,只需要设置两个文件中的一个就可以了 2. 10,30 * * * 4 <job> 3. #at now +10 minutes myscript <ctrl-d>

  25. 课堂练习答案 4. ftp文件传输 telnet远程登录 5. 主机是独立的链接到网络的机器; 网关是特殊类型的主机,把两个或更多的物理网络 连接在一起 • hostname , ifconfig • /etc/hosts

More Related