Rootop 服务器运维与web架构

2019-07-24
发表者 Venus
xftp找不到匹配的outgoing encryption算法已关闭评论

xftp找不到匹配的outgoing encryption算法

xshell能连上服务器,但是xftp报错:找不到匹配的outgoing encryption算法。

解决:注意是修改xftp,不是改xshell。

再重新打开xftp就可以连接。

 

 

2019-07-22
发表者 Venus
awk 不打印某一列的输出已关闭评论

awk 不打印某一列的输出

比如一个a文件,内容如下,现在要实现不打印最后一列。

[root@localhost ~]# cat a
a b c

# 通过设置最后一列为空

[root@localhost ~]# cat a | awk '{$NF="";print$0}'
a b 

# $0 是打印所有列  (数字零)

[root@localhost ~]# cat a | awk '{print $0}'
a b c

# 排除多列

[root@localhost ~]# cat a | awk '{$2="";$NF="";print$0}'
a  
[root@localhost ~]# cat a | awk '{$2="";print$0}'
a  c

# 排除多列另一种写法 (等于多次变量赋值)

[root@localhost ~]# cat a | awk '{$2=$NF="";print$0}'
a  

上面可以看到排除的那列变为了一列空列,再用tr(tr是translate缩写)去除空列:

[root@localhost ~]# cat a | awk '{$2="";print$0}'
a  c # 中间有空列
[root@localhost ~]# cat a | awk '{$2="";print$0}' | tr -s ' ' ' '
a c # 排除了空列

tr -s参数意思是如果有多个连续相的同字符就合并为1个。

2019-07-19
发表者 Venus
Failed to get D-Bus connection: Operation not permitted已关闭评论

Failed to get D-Bus connection: Operation not permitted

版本信息:

root@deepin:~# docker --version
Docker version 18.09.6, build 481bc77
root@deepin:~# docker run -dit --name test centos /usr/sbin/init
在容器内启动apache
[root@8065435580b6 ~]# systemctl start httpd
Failed to get D-Bus connection: Operation not permitted

以前遇到这个报错,是通过docker run创建容器时执行 /usr/sbin/init 这个命令解决,现在发现也不好用了,还需要加上–privileged=true

root@deepin:~# docker run -dit --name test --privileged=true centos /usr/sbin/init

安装apache再用systemctl启动测试:

[root@7e43e6387f93 /]# systemctl start httpd
[root@7e43e6387f93 /]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      2421/httpd     

2019-07-18
发表者 Venus
/usr/bin/google-chrome: error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory已关闭评论

/usr/bin/google-chrome: error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory

问题:/usr/bin/google-chrome: error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory
解决:
[root@localhost xmrig-2.15.3-beta]# yum install -y epel*
[root@localhost xmrig-2.15.3-beta]# yum install -y GConf2
[root@localhost xmrig-2.15.3-beta]# find / -name libgconf*
/usr/lib64/GConf/2/libgconfbackend-oldxml.so
/usr/lib64/GConf/2/libgconfbackend-xml.so
/usr/lib64/libgconf-2.so.4
/usr/lib64/libgconf-2.so.4.1.5

2019-07-18
发表者 Venus
jenkins配置Publish Over SSH 插件已关闭评论

jenkins配置Publish Over SSH 插件

jenkins版本:Jenkins ver. 2.176.1

1、安装 Publish Over SSH 插件

2、配置ssh server:

找到 “Manage Jenkins” – “configure system” – 往下拉找 “Publish over SSH” 配置项

比如我这里配置信息如下:

点一下 测试配置,确认配置信息无误。

3、去配置项目:

在项目配置中,选择 “构建后操作” – “send build artifacts over ssh

 

开始构建,看 控制台输出

提示传输一个文件成功。去192.168.10.82服务器查看。

这样就在服务器上的/home/jar下自动创建了project-A/api目录,并且jar包也复制过来了。