12/09/2019

修复损坏的VMDK文件

先打开VMware的SSH,检查一下对应的vmdk文件:
vmkfstools -x check /path/to/your/machine.vmdk(修改成自己的路径及文件名)
如果提示“Disk needs repair.”
运行修复命令:
vmkfstools -x repair /path/to/your/machine.vmdk(修改成自己的路径及文件名)
修复速度很快,完成后后提示“Disk was successfully repaired.”
这时就可以启动虚拟机了

5/18/2019

RouterOS 重新拨号后,从接口获得新ip并更新规则

备忘,
范例
1
2
3
4
5
6
7
:global ipaddr [/ip address get [/ip address find interface=pppoe4plex] address]
:set ipaddr [:pick $ipaddr 0 ([len $ipaddr] -3)]
:global oldip [/ip firewall nat get [/ip firewall nat find comment="plexdstnat"] dst-address]
:if ($ipaddr != $oldip) do={
:log info [/ip firewall nat set [/ip firewall nat find comment="plexdstnat"] dst-address=$ipaddr]
:log info [/ip firewall nat set [/ip firewall nat find comment="plexsrcnat"] to-addresses=$ipaddr]
}

RouterOS Cloudflare DDNS Script 脚本

also here

备忘

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
################# CloudFlare variables #################
:local CFDebug "true"
:global WANInterface "pppoe4plex"

:local CFdomain "*****.lingbo.me"
:local CFzone "lingbo.me"

:local CFrecordType "A"
:local CFemail "****************@gmail.com"
:local CFtkn "bc24e143b3840****************9e13a5"

:local CFzoneid "a926a****************accb8"
:local CFid "661c43a****************95994087"

#########################################################################
######################## DO NOT EDIT BELOW ############################
#########################################################################

################# Internal variables #################
:local resolvedIP ""
:global WANip ""

################# Resolve and set IP-variables #################
:local currentIP [/ip address get [/ip address find interface=$WANInterface ] address];
:set WANip [:pick $currentIP 0 [:find $currentIP "/"]];
:set resolvedIP [:resolve $CFdomain];

################# Build CF API Url (v4) #################
:local CFurl "https://api.cloudflare.com/client/v4/zones/"
:set CFurl ($CFurl . "$CFzoneid/dns_records/$CFid");

######## Write debug info to log #################
:if ($CFDebug = "true") do={
:log info ("CF: hostname = $CFdomain")
:log info ("CF: resolvedIP = $resolvedIP")
:log info ("CF: currentIP = $currentIP")
:log info ("CF: WANip = $WANip")
:log info ("CF: CFurl = $CFurl&content=$WANip")
};

######## Compare and update CF if necessary #####
:if ($resolvedIP != $WANip) do={
:log info ("CF: Updating CF, setting $CFDomain = $WANip")
/tool fetch http-method=put mode=https url="$CFurl" http-header-field="X-Auth-Email:$CFemail,X-Auth-Key:$CFtkn,content-type:application/json" output=none http-data="{"type":"$CFrecordType","name":"$CFdomain","content":"$WANip"}"
/ip dns cache flush
} else={
:log info "CF: No Update Needed!"
}

2/16/2019

copy files on freenas

1
 find /mnt/vol1/ptdataset/ptuser/download/ -name '*.mp4' -print0 | xargs -0 -I% cp -nrsv % /mnt/vol1/lnk/

拷贝整个目录并创建硬链接

1
cp -al <origdir> <newdir>

甲骨文云ubuntu系统关防火墙

  6、Ubuntu系统 开放所有端口 iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT iptables -F Ubuntu镜像默认设置了Iptable规则,关闭它, ap...