From 896abe2963d7730e77530d22ee41764073d91ccf Mon Sep 17 00:00:00 2001 From: velor2012 <38395332+velor2012@users.noreply.github.com> Date: Thu, 2 Feb 2023 03:22:44 +0800 Subject: [PATCH] init --- Dockerfile | 12 ++++++++++++ README.md | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- start.amd.sh | 1 + start.arm.sh | 1 + start.sh | 1 + 5 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 start.amd.sh create mode 100644 start.arm.sh create mode 100644 start.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9c44b4c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:18.04 +WORKDIR /app + +#RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list +#RUN sed -i s@/security.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list +RUN apt-get update +RUN apt-get -y install vim cmake build-essential wget git + +RUN git clone https://github.com/flow2000/lookbusy.git +RUN cd lookbusy && chmod +x ./configure && ./configure && make +# COPY start.sh /root/ +CMD ["sh", "/app/start.sh"] \ No newline at end of file diff --git a/README.md b/README.md index 02f8e7c..8b005fd 100644 --- a/README.md +++ b/README.md @@ -1 +1,50 @@ -# lookbusy-docker \ No newline at end of file +# lookbusy-docker + +用于使你的服务器看起来很忙碌 +原项目为 https://github.com/flow2000/lookbusy +本项目将其封装为docker进行部署 + +## 使用方法 + +### 构建镜像 +``` shell +docker build . t lookbusy +``` + +x86 + +## 使用方法 + +### 修改运行参数 +修改 start.sh中的各项参数,参考如下 + +``` shell +lookbusy -c 50 # 占用所有 CPU 核心各 50% +lookbusy -c 50 -n 2 # 占用两个 CPU 核心各 50% +lookbusy -c 50-80 -r curve # 占用所有 CPU 核心在 50%-80% 左右浮动 +lookbusy -c 0 -m 128MB -M 1000 # 每 1000 毫秒,循环释放并分配 128MB 内存 +lookbusy -c 0 -d 1GB -b 1MB -D 10 # 每 10 毫秒,循环进行 1MB 磁盘写入,临时文件不超过 1GB +``` + +此处参考博客 +https://51.ruyo.net/18289.html + +### 运行 + +``` shell +docker run -d --name lookbusy --restart=always -v /PATH/TO/start.sh:/app/start.sh lookbusy +``` +其中 **/PATH/TO/start.sh** 指到达克隆下来的lookbusy仓库的start.sh脚本的绝对路径 + +## 懒人方法 + +``` shell +wget https://raw.githubusercontent.com/velor2012/lookbusy-docker/main/start.sh +``` + +修改start.sh配置后 +``` +docker run -d --name lookbusy --restart=always -v /PATH/TO/start.sh:/app/start.sh velor2012/lookbusy${-arm} +``` +**注意**如果是arm架构,需要在lookbusy后加上-arm,即镜像名为velor2012/lookbusy-arm + diff --git a/start.amd.sh b/start.amd.sh new file mode 100644 index 0000000..0a60726 --- /dev/null +++ b/start.amd.sh @@ -0,0 +1 @@ +/app/lookbusy/lookbusy -c 10 \ No newline at end of file diff --git a/start.arm.sh b/start.arm.sh new file mode 100644 index 0000000..50c6e65 --- /dev/null +++ b/start.arm.sh @@ -0,0 +1 @@ +/app/lookbusy/lookbusy -c 50-60 -r curve -n 2 \ No newline at end of file diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..3e0cacb --- /dev/null +++ b/start.sh @@ -0,0 +1 @@ +/app/lookbusy/lookbusy -c 50-80 -r curve -n 2 \ No newline at end of file