ubuntu18 查看和修改时区

查看时间:

timedatectl status

或:

date -R

结果:

                      Local time: Wed 2019-05-22 22:10:53 PDT
                  Universal time: Thu 2019-05-23 05:10:53 UTC
                        RTC time: Thu 2019-05-23 05:11:24
                       Time zone: America/Los_Angeles (PDT, -0700)
       System clock synchronized: no
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

解决J4105、J5005等设备emby解码乱码,花屏,绿屏,卡顿的经验

我有一台J5005的黑群晖,在使用emby硬件解码播放高清影片时,硬解能打开,但是会出现花屏和卡顿的现象。
经过几番努力,找到了一个可用的解决办法。
问题在于显卡iHD_drv_video.so这个驱动问题,不管是Plex,Emby,JellyFin均会碰到此情况。
通过进入emby容器中禁用该驱动就可以解决该问题。

首先进入名为emby的容器

docker exec -it emby /bin/sh

进入驱动目录

cd lib/dri/

将驱动重命名来实现禁用

mv iHD_drv_video.so iHD_drv_video.so.disabled

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

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

解决方案: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