两条命令解决黑群晖不休眠的问题

发现黑群晖不休眠的原因是因为在运行中会频繁向磁盘写入日志,导致不能休眠或者频繁唤醒。

解决方案:ssh登陆后在开机启动脚本/etc/rc.local文件的最上边追加两行代码后,重启即可。
没有这个文件就新建一个,并给755权限。

touch /etc/rc.local & chmod 755 /etc/rc.local
mkdir /tmp/log & mount -o bind /tmp/log /var/log

代码说明: 将日志文件夹/var/log/的所有读写操作重定向到内存中,避免直接对磁盘的读写操作。

docker容器增加--restart=always参数

创建容器时没有添加参数 --restart=always ,导致的后果是:当 Docker 重启时,容器可能不能自动启动

现在要添加该参数怎么办呢,可以通过以下方法实现,且无需重启或者重建容器:

docker container update --restart=always 容器名字(或者ID)

如何重置iptables规则

重置所有iptables规则,包括自定chain

# reset the default policies in the filter table.
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT

# reset the default policies in the nat table.
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P POSTROUTING ACCEPT
iptables -t nat -P OUTPUT ACCEPT

# reset the default policies in the mangle table.
iptables -t mangle -P PREROUTING ACCEPT
iptables -t mangle -P OUTPUT ACCEPT

# flush all the rules in the filter and nat tables.
iptables -F
iptables -t nat -F
iptables -t mangle -F

# erase all chains that's not default in filter and nat table.
iptables -X
iptables -t nat -X
iptables -t mangle -X

威联通添加计划任务

1.查看计划任务

crontab -l

2.添加计划任务

echo "*/5 * * * * /share/homes/admin/raid1_monitor.sh" >> /etc/config/crontab
echo "0 3 * * * /share/homes/admin/readd_raid1.sh" >> /etc/config/crontab
echo "5 3 * * * /share/homes/admin/fail_raid1.sh" >> /etc/config/crontab

或者直接编辑/etc/config/crontab文件

vi /etc/config/crontab

注意:威联通上不可以用Linux下的crontab -e命令来编辑计划任务。

3.重启计划任务服务

crontab /etc/config/crontab && /etc/init.d/crond.sh restart

威联通qnap配置开机自启动项

一、添加启动项目

根据官方文档群晖TS453Bmini 属于HAL-based Intel and AMD NAS,操作步骤如下:

0.先在系统设置里面打开“启动时运行用户自定义的进程”选项:

启动时运行用户自定义的进程启动时运行用户自定义的进程

1.挂载特殊分区

mkdir /tmp/config
mount $(/sbin/hal\_app --get\_boot\_pd port\_id=0)6 /tmp/config

2.新增启动脚本

vi /tmp/config/autorun.sh