SnappyMail重置管管理密码

找到配置文件application.ini删除admin_password配置,然后刷新/?admin页面

/data/_data_/_default_/configs/application.ini 

新的初始密码在admin_password.txt里面

/data/_data_/_default_/admin_password.txt

然后再登录进去重置新的密码。

 

本文引用自https://luxing.im/reset-snappymail-admin-portal-password/

https://snappymail.eu/documentation/admin-configuration

inotify+rsync 自动同步systemctl服务

安装inotify

sudo apt update
sudo apt install inotify-tools rsync -y

centos/RHEL系列用dnf安装

 

mkdir /opt/rsync_watch/
cat >/opt/rsync_watch/rsync_watch.sh<<'EOF'
#!/bin/bash

# 加载配置文件
ENV_FILE="/opt/rsync_watch/rsync_watch.env"
if [ -f "$ENV_FILE" ]; then
    export $(grep -v '^#' "$ENV_FILE" | xargs)
fi

# 检查必需变量
if [ -z "$LOCAL_DIR" ] || [ -z "$REMOTE_USER" ] || [ -z "$REMOTE_HOST" ] || [ -z "$REMOTE_DIR" ] || [ -z "$RSYNC_PORT" ]; then
    echo "请先在 $ENV_FILE 配置 LOCAL_DIR, REMOTE_USER, REMOTE_HOST, REMOTE_DIR, RSYNC_PORT"
    exit 1
fi

# RSYNC SSH 参数
RSYNC_SSH="ssh -p ${RSYNC_PORT}"

# RSYNC 默认选项
RSYNC_OPTS=${RSYNC_OPTS:-"-az --delete --exclude='.git/'"}

echo "Starting initial sync..."
rsync $RSYNC_OPTS -e "$RSYNC_SSH" --progress --itemize-changes "$LOCAL_DIR/" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"

echo "Watching for changes in $LOCAL_DIR ..."
inotifywait -m -r -e modify,create,delete,move --format '%w%f' "$LOCAL_DIR" |
while read -r FILE; do
    echo "$(date '+%F %T') Detected change: $FILE"
    rsync $RSYNC_OPTS -e "$RSYNC_SSH" --progress --itemize-changes "$LOCAL_DIR/" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"
done
EOF

 

/opt/rsync_watch/rsync_watch.env配置文件

LOCAL_DIR=/path/to/local/dir
REMOTE_USER=user
REMOTE_HOST=remote.host.com
REMOTE_DIR=/path/to/remote/dir
RSYNC_PORT=2222
RSYNC_OPTS="-az --exclude='.git/'"

 

systemd配置

cat>/etc/systemd/system/rsync_watch.service<<EOF
[Unit]
Description=Rsync Watcher for Directory
After=network.target

[Service]
Type=simple
ExecStart=/opt/rsync_watch/rsync_watch.sh
Restart=always
RestartSec=5
User=root
WorkingDirectory=/opt/rsync_watch
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload # 重新加载 systemd 配置
sudo systemctl enable rsync_watch --now # 开机自启
sudo systemctl status rsync_watch # 查看状态

思科配置回顾备忘录

#查看邻居
show ip bgp neighbors <peer-ip>

#拒收默认路由规则
ip prefix-list DEFAULT-ROUTE-v4 seq 5 deny 0.0.0.0/0
ipv6 prefix-list DEFAULT-ROUTE-v6 seq 5 deny ::/0

#刷新收取路由
clear ip bgp <peer-ip> soft in

#查看BGP连接状态
show ip bgp summary
show bgp ipv6 unicast summary

#筛选配置内容
show running-config | section router bgp

#查看bgp邻居
show bgp ipv6 unicast neighbors <peer-ipv6>
show bgp ipv4 unicast neighbors <peer-ipv4>

#查看网卡状态信息
show ip interface brief

#查看宣告路由表
show bgp ipv6 unicast neighbors <peer-ipv6>  advertised-routes
show bgp ipv4 unicast neighbors <peer-ipv4> advertised-routes

router bgp 65000
no bgp enforce-first-as  #关闭拒收一个as非peer as的路由
neighbor <peer-ipv4> default-originate #BGP发送默认路由

思科路由不收IX路由表问题

帮人配置个思科路踩到个坑:翻了半天文档才发现ASR默认开启了 bgp enforce-first-as,导致路由表里首个 AS 不是peer AS 的前缀都在Local Policy Denied Prefixes里面。

router bgp 65536
 no bgp enforce-first-as

IX在发送交换路由的时候把自身AS过滤掉了,导致无法收表。

之前也用了chatgpt寻找答案,关键点也提到了IX在as-path过滤掉了自生AS,但是仍然没有正确解决思路都没提到,反而一直让route-map的规则里面找配置问题和重新配置BGP Session。

Linux暂停进程,恢复进程,接管进程备忘录

在运行的命令下按Ctrl+Z可以暂停进程运行

fg            #恢复到前台继续运行
jobs        # 查看后台任务
fg %1     # 恢复 jobs 列表里的 1 号任务
bg          #后台继续运行(不挂起)
bg %1   #默认恢复最后一个挂起的任务
disown -h %1  #挂起后转后台长期运行

 

reptyr接管pid

apt install reptyr -y # Debian/Ubuntu
yum install reptyr -y # CentOS/RHEL


reptyr 12345  #12345是pid进程

 

这样可以把一个长期运行需要观察输出的进程丢进screen\tmux里面挂机运行了