You've already forked www.colben.cn
update
This commit is contained in:
@@ -6,21 +6,21 @@ tags: ["websocket"]
|
||||
categories: ["web"]
|
||||
---
|
||||
|
||||
# 操作系统
|
||||
## 操作系统
|
||||
- CentOS7
|
||||
|
||||
# 下载 websocketd
|
||||
## 下载 websocketd
|
||||
- [websocketd-0.3.0-linux_amd64.zip](https://github.com/joewalnes/websocketd/releases/download/v0.3.0/websocketd-0.3.0-linux_amd64.zip)
|
||||
|
||||
# 安装 nc 命令
|
||||
## 安装 nc 命令
|
||||
```bash
|
||||
yum install nmap-ncat
|
||||
```
|
||||
|
||||
# 创建监听脚本
|
||||
## 创建监听脚本
|
||||
```bash
|
||||
cat > cmd.sh <<-END
|
||||
#!/bin/bash
|
||||
##!/bin/bash
|
||||
pkill -x nc
|
||||
while :; do
|
||||
nc -nkl 10088
|
||||
@@ -29,7 +29,7 @@ done
|
||||
END
|
||||
```
|
||||
|
||||
# 创建 log.html
|
||||
## 创建 log.html
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
@@ -86,7 +86,7 @@ break-all;
|
||||
</html>
|
||||
```
|
||||
|
||||
# 文件部署位置
|
||||
## 文件部署位置
|
||||
```
|
||||
websocketd/
|
||||
├── [-rwxr-xr-x] cmd.sh
|
||||
@@ -95,21 +95,21 @@ websocketd/
|
||||
└── [-rwxr-xr-x] websocketd
|
||||
```
|
||||
|
||||
# 启动 websocketd
|
||||
## 启动 websocketd
|
||||
```bash
|
||||
cd websocketd
|
||||
./websocketd --port=8008 --staticdir=. ./cmd.sh
|
||||
```
|
||||
|
||||
# 在浏览器中打开日志浏览页面
|
||||
## 在浏览器中打开日志浏览页面
|
||||
- http://{websocket-server}:8008/websocket/log.html
|
||||
|
||||
# 在其他应用服务器,传输实时日志
|
||||
## 在其他应用服务器,传输实时日志
|
||||
```bash
|
||||
tail -f /tomcat/logs/catalina.out | nc -n {websocket-server} 10088
|
||||
```
|
||||
|
||||
# 关闭实时日志
|
||||
## 关闭实时日志
|
||||
- 在目标服务器中 kill nc
|
||||
```bash
|
||||
pkill -x nc
|
||||
|
Reference in New Issue
Block a user