1.atd和crond两个任务管理程序的区别
atd单一执行的例行性任务: :单一执行的例行性工作:仅处理执行一次就结束了;
crond循环执行的例行性任务:每隔一定的周期就需要执行一次。
总的来说就是,at(一次性)crontab(周期性)。
2.2.指定在2023/03/29 19:00将时间写入testmail.txt文件中
#指定命令执行时间为2023/03/29 19:00
[root@333~]# at 19:00 032922
#命令不能执行已经过的时间
at: refusing to create job destined in the past
#指定命令执行时间为2023/08/26 21:00
[root@333~]# at 21:00 082622
warning: commands will be executed using /bin/sh
at> echo `date` > /testmail.txt
at> <EOT>
3.3.指定在每天凌晨4:00将该时间点之前的系统日志信息备份到个目录下(/var/log/messages ),备份后日志文件名显示格式logfileYY-MM-DD HH-MM
[root@333 ~]# 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.
4.在当前主机添加两块网卡,将两块网卡绑定实现网卡冗余操作。
网卡配置文件
[root@333 ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens160
网卡配置
[root@333 ~]#
nmcli connection modify ens160
ipv4.addresses 192.168.58.129/24
ipv4.gateway 192.168.58.2
ipv4.dns 114.114.114.114 +ipv4.dns 8.8.8.8
ipv4.method manual connection.autoconnect yes
[root@333 ~]# nmcli connection up ens160
查看网卡详情
[root@333 ~]# nmcli device status
DEVICE TYPE STATE CONNECTION
ens160 ethernet connected ens160
virbr0 bridge connected (externally) virbr0
ens224 ethernet disconnected --
ens256 ethernet disconnected --
lo loopback unmanaged --
virbr0-nic tun unmanaged --
[root@333 ~]# nmcli device connect ens224
Device 'ens224' successfully activated with '2e25a153-2d98-4f51-bc8d-330a521f72f6'.
[root@333 ~]# nmcli device connect ens256
Device 'ens256' successfully activated with '038b77e2-3ed1-4785-bbe6-b90718c1e697'.
[root@333 ~]# cd /usr/share/doc/teamd/example_configs/
[root@333 example_configs]# ll
total 64
-rw-r--r--. 1 root root 305 Jul 26 2020 activebackup_arp_ping_1.conf
-rw-r--r--. 1 root root 465 Jul 26 2020 activebackup_arp_ping_2.conf
-rw-r--r--. 1 root root 194 Jul 26 2020 activebackup_ethtool_1.conf
-rw-r--r--. 1 root root 212 Jul 26 2020 activebackup_ethtool_2.conf
-rw-r--r--. 1 root root 241 Jul 26 2020 activebackup_ethtool_3.conf
-rw-r--r--. 1 root root 447 Jul 26 2020 activebackup_multi_lw_1.conf
-rw-r--r--. 1 root root 285 Jul 26 2020 activebackup_nsna_ping_1.conf
-rw-r--r--. 1 root root 318 Jul 26 2020 activebackup_tipc.conf
-rw-r--r--. 1 root root 96 Jul 26 2020 broadcast.conf
-rw-r--r--. 1 root root 209 Jul 26 2020 lacp_1.conf
-rw-r--r--. 1 root root 98 Jul 26 2020 loadbalance_1.conf
-rw-r--r--. 1 root root 140 Jul 26 2020 loadbalance_2.conf
-rw-r--r--. 1 root root 183 Jul 26 2020 loadbalance_3.conf
-rw-r--r--. 1 root root 93 Jul 26 2020 random.conf
-rw-r--r--. 1 root root 244 Jul 26 2020 roundrobin_2.conf
-rw-r--r--. 1 root root 97 Jul 26 2020 roundrobin.conf