JoyLau's Blog

JoyLau 的技术学习与思考

写法记录

1
2
3
4
5
6
7
8
9
10
CREATE PROCEDURE insert_bulk(in max_num int(10))
begin
declare i int default 0;
set autocommit = 0;
repeat
set i = i + 1;
INSERT INTO `table`(xxx) VALUES (xxx);
until i = max_num end repeat;
commit;
end;
阅读全文 »

修改代码

修改 view.js 的初始化 setInitialView 方法 在该方法最下面加入下面代码

1
2
3
4
5
6
7
8
9
var urlPath=decodeURIComponent(window.parent.document.location);
var index=urlPath.indexOf("keyword");
if (index === -1) {
return;
}
var keyword=urlPath.substr(index+8);
console.log(urlPath, index, keyword);
document.getElementById("findInput").value=keyword;
document.getElementById("findHighlightAll").click();
阅读全文 »

脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
import hudson.tasks.LogRotator
Jenkins.instance.allItems(Job).each { job ->
println "$job.builds.number $job.name"
if ( job.isBuildable() && job.supportsLogRotator()) {
// 注释if所有任务统一设置策略,去掉注释后只更改没有配置策略的任务
//if ( job.getProperty(BuildDiscarderProperty) == null) {
job.setLogRotator(new LogRotator (-1, 3))
//}
//立马执行Rotate策略
job.logRotate()
println "$job.builds.number $job.name 磁盘回收已处理"
} else { println "$job.name 未修改,已跳过" }
}
return;

LogRotator 有 2 个构造方法, 一个是 2 个参数的, 一个是 4 个参数的,构造参数分别为:

阅读全文 »

1
ioreg -l |grep \"PerformanceStatistics\" | cut -d '{' -f 2 | tr '|' ',' | tr -d '}' | tr ',' '\n'|grep 'Temp\|Fan'

显示如下:

1
2
3
"Fan Speed(%)"=17
"Fan Speed(RPM)"=0
"Temperature(C)"=49

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
upstream MDM_WS {
hash '$proxy_add_x_forwarded_for';
server mdm:6611;
server mdm-slave:6611;
}

upstream MDM_SERVER {
hash '$proxy_add_x_forwarded_for';
server mdm:6603;
server mdm-slave:6608;
}

server {
listen 80;
underscores_in_headers on;

location /mdmWs {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_buffering off;

proxy_pass http://MDM_WS/mdmWs/;
}

location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_buffering off;

proxy_pass http://MDM_SERVER/;
}


}

步骤

有时需要进行数据的备份和恢复, 涉及到大量的小文件拷贝, 速度很慢,找了一个速度相对较快的命令来操作, 记录下

1
cd source/; tar cf - . | (cd target/; tar xvf -)
0%