问题
1.atd和crond两个任务管理程序的区别
2.指定在2023/03/29 19:00将时间写入testmail.txt文件中
3.指定在每天凌晨4:00将该时间点之前的系统日志信息备份到个目录下(/var/log/messages ),备份后日志文件名显示格式logfileYY-MM-DD HH-MM
4.在当前主机添加两块网卡,将两块网卡绑定实现网卡冗余操作。
答案
1.atd是一次性作业
crond是周期性作业
2.[root@server ~]# at 19:00 2023-03-29
at: refusing to create job destined in the past
[root@server ~]# at 19:00 2023-03-29
at: refusing to create job destined in the past
[root@server ~]# at 19:00 2023-04-02
warning: commands will be executed using /bin/sh
at> date >> /root/testmail.txt
at> <EOT>
job 5 at Sun Apr 2 19:00:00 2023
3.
[root@server ~]# vim /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
00 04 * * * root cp/var/log/messages /logfile`date +%F%R`;echo > /var/log/messages
4.
1.一台主机两块网卡,添加网卡
首先在软件VMware Workstation Pro主界面的上侧指示栏上点击“虚拟机”
接着选中最下面的“设置”,在设置硬件中选择“添加”这一项,最后选中“网络适配器”,完成即可。
本次实验需要添加两块网卡,重复此步骤一次,保证两个网卡是同一种网络模式(同一网段)。
在软件中查看网卡是否添加完成,主机能否识别网卡
命令:
[root@localhost ~]# ip a
2.激活真实网卡
命令:
[root@localhost huawei]# nmcli device connect ens224
[root@localhost huawei]# nmcli device connect ens256
3.添加虚拟网卡team0(主设备)
[root@localhost example_configs]# nmcli connection add type team con-name team0 ifname team0 config '{"runner": {"name": "activebackup"}}'
"runner": {"name": "activebackup"}出处
[root@localhost huawei]# cd /usr/share/doc/teamd/example_configs/ //切换目录(共享文本)
[root@localhost example_configs]# ll //查看模式
[root@localhost example_configs]# vim activebackup_arp_ping_2.conf //查看主备模式
4.虚拟网卡绑定真实网卡(从设备)
[root@localhost example_configs]# nmcli connection add type team-slave con-name team0-port1 ifname ens224 master team0
[root@localhost example_configs]# nmcli connection add type team-slave con-name team0-port2 ifname ens256 master team0
5.添加设备
先激活从会话,再激活主会话
[root@localhost example_configs]# nmcli connection up team0-port1
[root@localhost example_configs]# nmcli connection up team0-port2
[root@localhost example_configs]# nmcli connection up team0