作者归档:John

timedatectl

根据Ubuntu的说法:

ntpdate is considered deprecated in favor of timedatectl (or chrony) andthereby no more installed by default. timesyncd will generally do the rightthing keeping your time in sync, and chrony will help with more complexcases.

timedatectl 用起来非常简单,默认配置文档在/etc/systemd/timesyncd.conf

最简化内容:

[Time]
NTP=
FallbackNTP=pool.ntp.org
RootDistanceMaxSec=5
PollIntervalMinSec=32
PollIntervalMaxSec=2048

通常不需要做任何改动,如果要增加自定义的ntp服务器写在第一行,空格分隔

启用:

timedatectl set-ntp true

如果报错:Failed to set ntp: NTP not supported.
自己动手干掉已有的ntpd或者ntp再来,还是不行自己动手装chrony

查看状态:

timedatectl status

大概这样就是启用成功并同步成功了,据说需要一些时间

Local time: Fri 2019-06-14 14:28:52 CST
Universal time: Fri 2019-06-14 06:28:52 UTC
RTC time: n/a
Time zone: Asia/Shanghai (CST, +0800)
Network time on: yes
NTP synchronized: yes
RTC in local TZ: no

设置时区:

timedatectl set-timezone Asia/Shanghai

虽然似乎有点ZZ不正确的样子(从小到大都只知道北京时间),据说是因为:

The reason why Asia/Shanghai is used instead of Beijing is because Shanghai is the most populous location in the zone.

印象中以前折腾Ubuntu时候还有Asia/Chongqing,也被backzone了

Asia/Kashgar, Asia/Chongqing, and Asia/Harbin, are kept in the “backzone” file of the IANA timezone database for backward compatibility.

重启:systemctl restart systemd-timedated

Debian通过,Centos不知道为什么死活不同步,不管了

ref:

https://wiki.archlinux.org/index.php/Systemd-timesyncd

https://en.wikipedia.org/wiki/Tz_database

https://en.wikipedia.org/wiki/Time_in_China

 

用NSSM把exe注册为服务

搜了一下,看起来非常简单

To create a Windows Service from an executable, you can use sc.exe:

sc.exe create <new_service_name> binPath= "<path_to_the_service_executable>"

但是:

Note that it will not work for just any executable: the executable must be a Windows Service (i.e. implement ServiceMain). When registering a non-service executable as a service, you’ll get the following error upon trying to start the service:

Error 1053: The service did not respond to the start or control request in a timely fashion.

那就只能用第三方的了,有人推荐用NSSM:

http://nssm.cc/download

NSSM – the Non-Sucking Service Manager

名字简单又暴力,使用也是很简单暴力

下载,解压,找到32或者64位的exe

开一个管理权限的cmd,nssm.exe install SERVICENAME

回车,就有gui了,跟着gui走,完工

搬家完毕

大概是因为5月35号要到了,突然IP就敏感了,找了一圈linode的东京区速度理想:

3.2 MB/s – 38.3 MB,共 100 MB,还剩 19 秒
大概就是这个概念
ping下来延迟70~80ms,碾压新加坡和美国不知道多少倍

用linode系统内的clone功能,直接把原来的vps整个搬走了,简单又暴力

Success
System Boot – My CentOS 7 Profile
Entered: 6 minutes 58 seconds ago – Took: 10 seconds
Success
Migrate Disk – CentOS 7 Disk from fremontXXXX.linode.com
Entered: 44 minutes 53 seconds ago – Took: 35 minutes, 19 seconds
100.0% done, 0:00 to go, 6.90 MB/s
Success
Migrate Disk – 512MB Swap Image from fremontXXXX.linode.com
Entered: 44 minutes 53 seconds ago – Took: 58 seconds
100.0% done, 0:00 to go, 9.40 MB/s
Success
Linode Initial Configuration
Entered: 45 minutes 46 seconds ago – Took: 0 seconds

apache2+php环境下nextcloud报413 Request Entity Too Large

之前一直好好的nextcloud突然抽风,确认了apache和php的文件大小限制没问题,运行时间也没问题,找了很久有人提到去看apache的error_log才找到原因:

ModSecurity: Request body (Content-Length) is larger than the configured limit (13107200).

那就干掉ModSecurity吧,反正是内网环境

万能的FTP–本地文件传输续传终极方案

case:

一个1.2TB的单文件vhd,从一块物理硬盘复制到了另一块备份盘,然后从备份盘再往下一个机器复制时候,死活跑不过50%进度,不管是用硬盘还是直接塞进机器里,每次到49%附近速度就降到了不到1m每秒,同时有数据的备份盘响应时间飙升到15xxx毫秒,是的,没错,15秒,,基本确定是备份盘硬件问题,又不能太轻易放弃,后来发现重启下就可以恢复访问速度,那么就需要用到断点续传了,一直用的好好的teracopy不知道抽什么风不给续传的选项,最后想起来可以用FTP

方案:本机做ftp服务器,搞了个filezilla server,再用filezilla客户端去连接,剩下的就简单了