从Dnsmasq的日志里提取域名,并转换为conf文件

不啰嗦,看代码

import re
  
input_file_path = "/var/log/dnsmasq/dnsmasq.log"
output_file_path = "/home/xxx/cndomain.conf"
dns_server = "119.6.6.6"

with open(input_file_path, "r") as file:
    text = file.read()

pattern = r"[a-zA-Z]+\.(\w+\.\w+) "
matches = re.findall(pattern, text)

unique_domains = set(matches)

with open(output_file_path, "w") as file:
    for domain in unique_domains:
        file.write(f"server=/*.{domain}/{dns_server}\n")

VM虚拟机Ubuntu 20.04 LVM磁盘扩容

自行改变VHDX的大小。操作有风险,行动需谨慎。

  1. 检查分区
fdisk -l

2. 修复分区表

parted -l

3. 扩容

parted /dev/sda 
unit s
p free
resizepart 3 #此提示你输入空闲空间末尾的数字,照着 p free显示的结果自行输入 end那一列的数字
q

4.更新卷

pvresize /dev/sda3 
lvdisplay
lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
resize2fs /dev/ubuntu-vg/ubuntu-lv

请在root权限下执行