作者归档:John

用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客户端去连接,剩下的就简单了

windows server 2016 创建存储池看不到物理硬盘显示没有可用磁盘组

不知道是抽什么风,已经按要求将磁盘所有分区删除,并转换到MBR和基本磁盘,空间显示可用状态,后来找到一篇文章提到可以用power shell创建,按流程走,绕开GUI居然成功了,匪夷所思

参考:https://argonsys.com/learn-microsoft-cloud/articles/create-storage-pool-storage-spaces-standard/

打开一个管理员权限的powershell,先Get-PhysicalDisk,可以看到那个可用于pool的磁盘,复制磁盘Friendly Name:

然后就是创建存储池了,先准备参数:

$s=Get-StorageSubSystem(没太理解为什么要这么做,照抄,大概是为了获取存储子系统的UUID)

$disk=Get-PhysicalDisk -FriendlyName ST2000DM001-1CH164(这里就是那个CanPool的磁盘FriendlyName)

New-StoragePool -FriendlyName Pool1 -StorageSubSystemUniqueId $s.UniqueId -PhysicalDisks $disk

几秒钟后就创建成功了,然后回到存储池的GUI也可以看到,目标达成