跳转至

Tutorials

Nvidia Nsight

Nsight system compute & Graph 的关系

Nsight Systems

All developers should start with Nsight Systems to identify the largest optimization opportunities. Nsight Systems provides developers a system-wide visualization of an applications performance. Developers can optimize bottlenecks to scale efficiently across any number or size of CPUs and GPUs; from large servers to our smallest SoC. For further optimizations to compute kernels developers should use Nsight Compute or to further optimize a graphics workloads, use Nsight Graphics.

Nsight Compute

Nsight Compute is an interactive kernel profiler for CUDA applications. It provides detailed performance metrics and API debugging via a user interface and command line tool. Nsight Compute also provides customizable and data-driven user interface and metric collection that can be extended with analysis scripts for post-processing results.

Nsight Graphics

Nsight Graphics is a standalone application for the debugging, profiling, and analysis of graphics applications on Microsoft Windows and Linux. It allows you to optimize the performance of your Direct3D 11, Direct3D 12, DirectX Raytracing 1.1, OpenGL, Vulkan, and KHR Vulkan Ray Tracing Extension based applications.

Install Nsight local

  1. check the perf config To collect thread scheduling data and IP (instruction pointer) samples
  2. cat /proc/sys/kernel/perf_event_paranoid
  3. 如果大于2,临时改变 sudo sh -c 'echo 2 >/proc/sys/kernel/perf_event_paranoid'重启会重置
  4. 永久修改 sudo sh -c 'echo kernel.perf_event_paranoid=2 > /etc/sysctl.d/local.conf'
  5. 下载Nsight
  6. 但是单独下载要会员
  7. 下载cuda toolkit,有集成

Nsight System

目标与功能

运行 nsight-sys,可以从整体上看GPU,CPU资源的使用情况,和分辨出热点函数和kernel,但是对于为什么是热点给不出具体分析。

基本使用

勾选了CUDA-trace, GPU Metrics选项

GPU Metrics 需要 sudo

否则会报错。一般情况下使用sudo能保证0 error

GPU Metrics [0]: The user running Nsight Systems does not have permission to access NVIDIA GPU Performance Counters on the target device. For more details, please visit https://developer.nvidia.com/ERR_NVGPUCTRPERM
  - API function: NVPW_GPU_PeriodicSampler_GetCounterAvailability(&params)
  - Error code: 17
  - Source function: static std::vector<unsigned char> QuadDDaemon::EventSource::GpuMetricsBackend::Impl::CounterConfig::GetCounterAvailabilityImage(uint32_t)
  - Source location: /dvs/p4/build/sw/devtools/Agora/Rel/DTC_F/QuadD/Target/quadd_d/quadd_d/jni/EventSource/GpuMetricsBackend.cpp:609

Profile 速度

大致2到3倍时间:默认采样率,单独运行52s, Nsight-sys模拟需要135s。

HPC APP : PCIE, GPU DRAM Bandwidth, Warp

GPU Metrics选项能看出 PCIE, GPU DRAM Bandwidth, Warp的使用情况。

Compute Warps in Flight

将鼠标放在上面会有具体的数值或者名称的解释,(正在使用的Warps)

Unallocated Warps in Active SMs
  • Definition: This metric represents the number of warps that are not actively executing but are assigned to an active Streaming Multiprocessor (SM).
  • Interpretation: In CUDA, SMs are the fundamental processing units on the GPU. Each SM can execute multiple warps concurrently. "Unallocated Warps in Active SMs" indicates the number of warps that are ready to be scheduled on an SM but are currently waiting due to resource contention or other factors. A high number may suggest that there is room for additional work but available resources are not fully utilized.
NVTX

由于没有根据kernel function区分,很难读。为此提供了NVTX来给代码打标签

The NVIDIA Tools Extension Library (NVTX)

使用NVTX可以在C代码里插入标记,使得Nvsight能有效监控区域代码。

头文件:1

#include <nvToolsExt.h>

需要标记代码前后加入:

nvtxRangePush("checkResult"); //nvtxRangePushA,nvtxRangePushW,nvtxRangePushEx 好像都差不多
checkResult<<<dim3(row_num / TPBX, col_num / TPBY, 1), dim3(TPBX, TPBY, 1)>>>(row_num, col_num, result);
cudaDeviceSynchronize(); 
nvtxRangePop();

注意NVTX是作用在CPU线程上的,无法在GPU里用。

注意需要 g++ -o testnv -I/usr/local/cuda/include -L/usr/local/cuda/lib64 -lnvToolsExt testnv.cpp。或者修改cmake来实现同样的效果

NVTX问题:怎么不在同一竖直方向上?GPU还先跑是什么情况2

AI APP: Stable Diffusion XL

具体分析见 Deploy Stable Diffusion to A100

Nsight Compute

  • Nsight Systems 就是nvprof的继任者,NVIDIA最新的用于监测 kernel timeline的工具。
  • NVIDIA 计算能力7.5及以上的GPU设备(从A100开始)不再支持nvprof工具进行性能剖析,提示使用Nsight Compute作为替代品.

目标与功能

默认kernel模式,会根据 function的调度关系,将程序划分为kernel

  1. Summary: 给出in-order执行的每个kernel的参数,时间,资源占用(寄存器,计算访存单元)信息。
    1. Detail: 对于被选择的kernel给出, NV的优化建议
    2. Source:对于被选择的kernel给出, 给出源代码

基本使用

# recommand running under sudo
ncu # 命令行 Nsight Compute CLI(ncu)
ncu-ui # GUI

Profile速度

目测模拟时间慢百倍。

使用Nsight Compute CLI (nv-nsight-cu-cli / ncu) 输出数据

nv-nsight-cu-cli -> ncu

下面是一个使用样例:

/usr/local/NVIDIA-Nsight-Compute/nv-nsight-cu-cli -o mnist -f --csv --profile-from-start off /usr/bin/python3 mnist.py

其中-o是为了输出.nsight-cuprof-report文件用于后续的可视化查看,-f为强制覆盖原有文件,--csv可是在console输出除 timeline 以外数据的时候以逗号分隔数据,方便拷贝至csv文件, --profile-from-start的使用方法和Nsight System以及nvprof一样。其余flag选项可见文档

上面的例子会生成mnist.nsight-cuprof-report文件。

注意

最前面的可执行文件需要绝对路径,如上面的python3需要使用 /usr/bin/python3。 生成过程中可能会产生很大的临时文件(几十G)。如果本次磁盘空间不够,可以设置如下环境变量来调整存储临时文件的地址。没有找到能直接使用 Nsight Compute 修改临时文件地址的方式。

export /TMPDIR=/path/for/tmp

ncu与nvprof命令行抓取参数的映射表

https://www.freesion.com/article/34871449930/

ncu-ui教程

为了显示原代码makefile添加 -g -G选项 对应CmakeList.txt

target_compile_options(better PUBLIC $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda
    -G -src-in-ptx
    >)

https://blog.csdn.net/yan31415/article/details/109491749

ncu-ui表格&图

我不明白我的SMEM怎么不是从DRAM来的, 而且峰值怎么这么低?

这个错误也是令人迷惑 The memory access pattern for loads from L1TEX to L2 is not optimal. The granularity of an L1TEX request to L2 is a 128 byte cache line. That is 4 consecutive 32-byte sectors per L2 request. However, this kernel only accesses an average of 3.7 sectors out of the possible 4 sectors per cache line. Check the Source Counters section for uncoalesced loads and try to minimize how many cache lines need to be accessed per memory request.

不知道为什么有1%和2% 的bank conflict

可以看到 SMEM, Register,Block Size是怎么影响GPU Warp的分配调度的。 上图没有拖累,吃满了64个warp。

关于if语句 if语句只要warp里执行相同就行。

可以提示出不连续访问的地方。(这里是这样设计的,已经避免了绝大部分的不连续访问)

显示stall最多的指令是什么以及在等待什么。还有执行最多的指令

假如 file mismatched 手动选择文件就行

stall的信息,感觉就这些有点用。(其中sb是scoreboard的意思)

ncu-ui 分析汇编

PTX&SASS汇编说明

有两种汇编

请看PTX SASS一文

基本说明

可以通过指令执行数或者采样率来得知,执行最多的指令。

鼠标悬停可以知道具体命令的含义

Ex1: for循环头

Ex2: for-loop kernel

sdata[Regular_local_index]=arr_data[Regular_global_index];

该从DRAM里读取到SMEM的指令对应的PTX和SASS代码

cvt.f32.u16 d, a;   // convert 16-bit unsigned to 32-bit float

问题:无效self-mov?

为了隐藏延迟?

直接原因是PTX翻译成SASS。一条mov变多条了

CUDA Visual Profiler

老一代debugger工具,逐渐被Nsight淘汰

nvprof # 命令行,nsys 之前的名称叫做 nvprof
nvvp

在more里有建议

nvprof捕获信息存储

nvprof --analysis-metrics -o  nbody-analysis.nvprof ./nbody --benchmark -numdevices=2 -i=1
# 下面输出 .qdrep 文件
nsys profile --stats=true --force-overwrite=true  -o baseline-report ./single-thread-vector-add

CUDA Visual Profiler 问题

7196 Warning: Some profiling data are not recorded. Make sure cudaProfilerStop() or cuProfilerStop() is called before application exit to flush profile data.

解决方法在程序末尾加cudaDeviceReset()或者cudaProfilerStop()

Nsight Compute 问题

OpenGL 没有安装

Warning: Failed to get OpenGL version. OpenGL version 2.0 or higher is required.
OpenGL version is too low (0). Falling back to Mesa software rendering.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: offscreen, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

解决办法

sudo apt-get install libxcb-xinerama0
sudo apt install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0

Qt插件缺失

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.

Application could not be initialized!
    This is likely due to missing Qt platform dependencies.
    For a list of dependencies, please refer to https://doc.qt.io/qt-5/linux-requirements.html
    To view missing libraries, set QT_DEBUG_PLUGINS=1 and re-run the application.

按照说明 export QT_DEBUG_PLUGINS=1再次运行, 显示具体问题

Cannot load library /staff/shaojiemike/Install/cuda_11.7.0_515.43.04_linux/nsight-compute-2022.2.0/host/linux-desktop-glibc_2_11_3-x64/Plugins/platforms/libqxcb.so: (libxcb-xinput.so.0: cannot open shared object file: No such file or directory)

解决 sudo apt-get install libxcb-xinput0

kernel没权限profile

ERR_NVGPUCTRPERM - The user does not have permission to profile on the target device

要用sudo,或者最新的NV

could not connect to display localhost:10.0 under sudo

$ sudo ncu-ui
MobaXterm X11 proxy: Authorisation not recognised
qt.qpa.xcb: could not connect to display localhost:10.0

MobaXterm X11 proxy: Unsupported authorisation protocol
Error: Can't open display: localhost:10.0

解决办法(原因是sudo相当于切换到root用户,丢失了xauth信息)

$ xauth list
snode0/unix:12  MIT-MAGIC-COOKIE-1  84941f1f8be97d19436356685f75b884
snode0/unix:13  MIT-MAGIC-COOKIE-1  5172ee2c7364b055cd37538b460f7741
snode0/unix:11  MIT-MAGIC-COOKIE-1  589f3b5ab852f24ca3710c53e6439260
hades1/unix:10  MIT-MAGIC-COOKIE-1  9346adec202bd65250f3d21239025750
snode0/unix:10  MIT-MAGIC-COOKIE-1  52285c563f1688741fa1b434ed2b7b2c

sudo -s # 切换
xauth add snode0/unix:10  MIT-MAGIC-COOKIE-1  52285c563f1688741fa1b434ed2b7b2c # 补全xauth
# 正常执行 xauth有用的总是最后一个

GPU Metrics [0]: Sampling buffer overflow.

  1. 只勾选CUDA Metrics 和 GPU Metrics
  2. 降低采样频率

Error 0: UnsupportedGpu

原因是 软件对GPU的支持是逐步的需要安装最新的。

不支持的Nsight的可以尝试老的debugger工具 CUDA Visual Profiler

Error: Profiling is not supported on this device

Pascal support was deprecated, then dropped from Nsight Compute after Nsight Compute 2019.5.1.

The profiling tools that support Pascal in the CUDA Toolkit 11.1 and later are nvprof and visual profiler.

需要进一步的研究学习

暂无

遇到的问题

NVTX问题

开题缘由、总结、反思、吐槽~~

参考文献

https://developer.nvidia.com/tools-overview

https://www.365seal.com/y/zyn1yxJQn3.html

TinyMediaManager

docker-compose in Portainer

使用github的版本

tinymediamanager_service:
    image: romancin/tinymediamanager:latest
    container_name: tinymediamanager
    ports:
      - 5803:5800
    environment:
      - USER_ID=0
      - GROUP_ID=0
      - PASSWORD=acsa1411
      - TZ=Europe/Madrid
      - VNC_PASSWORD=password #建议去除
    volumes:
      - /bt:/bt
      - /share/Container/tinymediamanager:/config:rw
      - /share/Container/tinymediamanager/media:/media:rw
VNC 网页默认密码 password

口口字体问题

进入容器内bash,安装字体

docker exec -it  tinymediamanager bash
wget https://mirrors.aliyun.com/alpine/edge/testing/x86_64/font-wqy-zenhei-0.9.45-r2.apk
apk add --allow-untrusted font-wqy-zenhei-0.9.45-r2.apk
#  fc-list 查看字体
然后先将字体改成最后几个, 然后再改语言。

然后restart容器。注意不是重启stack(会删除容器,重启创建

tmm on Windows

利用网络挂载文件夹,用tMM软件刮削.

要注意动漫属于电视剧

多季度动漫管理

基础命名规则如下:

剧集英文名 (上映年份)/这是文件夹
---Specials /这是文件夹,存放OVA,特典,剧场版之类
------剧集英文名 S00E01.mp4
------剧集英文名 S00E02.mp4
------......
---Season 01 /这是文件夹,有几季就建几个文件夹
------剧集英文名 S01E01.mp4
------剧集英文名 S01E01.mp4
------......
---Season 02 /同上
------剧集英文名 S02E01.mp4
------剧集英文名 S02E02.mp4
------......
其中Specials里,视频文件后的S00表示这是“特典”,后面的E01代表“第几个特典”。

请根据TheTVDB里的数据确定你的ova视频的编号。

问题

DNS索引网站查看域名的中国服务器IP地址

实际ping速度,修改win10的hosts文件在C:\WINDOWS\system32\drivers\etc

需要进一步的研究学习

暂无

遇到的问题

暂无

开题缘由、总结、反思、吐槽~~

参考文献

https://www.bilibili.com/read/cv18956570/

Docker

简介

基于 Go 语言 并遵从 Apache2.0 协议开源。Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级、可移植的容器中,然后发布到任何流行的 Linux 机器上。

structure

Docker vs VMWare

相对于传统虚拟机,Docker 没有硬件虚拟化/hypervisor,可以运行在物理机、虚拟机, 甚至嵌套运行在 Docker 容器内,并且其不携带操作系统的,会轻巧很多。而且调用资源时利用 Docker Engine 去调用宿主的的资源,这时候过程是虚拟内存->真正物理内存。

Image title

Image title2

Linux内核的潜在兼容性问题

how docker run different ubuntu version Sharing the same running kernel? no SW conficts?

If your host kernel is "compatible enough" with the software in the container you want to run it will work; otherwise, it won't.1 So what does "compatible enough" mean? It depends on what requests the program makes of the kernel (system calls) and what features it expects the kernel to support. Some programs make requests that will break things; others don't.

Compatibility

on an Ubuntu 18.04 (kernel 4.19) or similar host:1 docker run centos:7 bash works fine. docker run centos:6 bash fails with exit code 139, meaning it terminated with a segmentation violation signal; this is because the 4.19 kernel doesn't support something that that build of bash tried to do. docker run centos:6 ls works fine because it's not making a request the kernel can't handle, as bash was. If you try docker run centos:6 bash on an older kernel, say 4.9 or earlier, you'll find it will work fine.

Portainer 统一管理

  • 安装Portainer Community Edition (CE)而不是Portainer Business Edition (BE)
  • WSL的安装和linux类似
    # 创建 Portainer Server 将用于存储其数据库的卷
    docker volume create portainer_data
    
    # 下载并安装 Portainer Server 容器, 9000为WebUI端口, 8000 是可选的,仅当您计划将边缘计算功能与边缘代理一起使用时才需要。
    docker run -d -p 8000:8000 -p 9000:9000 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /portainer_data:/data portainer/portainer-ce:2.11.1
    
  • Portainer里的docker部署: 建议使用 Stacks 下的 docker-compose 来进行

端口映射

2333:8000 为 容器内部端口8000,宿主机端口为2333

远程WebUI访问

默认部署在 http://localhost:9000, 可以如下操作来部署 http://222.195.72.218:9000/#!/home

# docker在服务器上时,可以关闭防火墙访问,也可以ssh代理到本地
brainiac1# ufw status
Status: inactive

Install

# 安裝 docker
curl -sSL get.docker.com | sh
# 將目前使用者新增到 docker 群組內,需要重新登入才會生效
sudo usermod -aG docker $USER

# 安裝 docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -sL https://api.github.com/repos/docker/compose/releases/latest | grep tag_name | cut -d'"' -f 4)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Relationship

dockerTripleThing

Dockerfile & Image & Container
  • Image like a static configed/compiled software using dockerfile/gcc.
  • And container is a running process that we can control.

Dockerfile

First, write an installation script for all of your dependencies. This script is written with Docker specific syntax and is called a Dockerfile(1).

  1. A Dockerfile is a script used to create a Docker image, which is a lightweight, standalone, and executable package that includes everything needed to run a piece of software, including the code, runtime, system tools, system libraries, and settings.

Building image using Dockerfile

Building image using Dockerfile
Using dockerfile in portainer

Images > Build image

Dockerfile

Here's a simple Dockerfile code snippet(it's usually built on official base image):

# Use an official base image
FROM ubuntu:20.04

# Set environment variables
ENV MY_ENV_VARIABLE my_value

# Run commands to install packages and set up the environment
RUN apt-get update && apt-get install -y \
    package1 \
    package2 \
    && rm -rf /var/lib/apt/lists/*

# Copy files from your local machine to the container
COPY local_directory /container_directory

# Set the working directory
WORKDIR /app

# Expose a port
EXPOSE 8080

# Define the command to run when the container starts
CMD ["command_to_start_application"]

In this example, and more options:

  • FROM specifies the base image, in this case, Ubuntu 20.04.
  • ENV sets an environment variable.
  • RUN executes commands to install packages.
  • COPY copies files from your local machine to the container.
  • WORKDIR sets the working directory within the container.
  • EXPOSE specifies that the container will listen on port 8080.
  • CMD defines the command that will be executed when the container starts.

Cheat Sheet

查看容器出错日志:docker logs --tail 1000 1fed0d4782cf最后一项是容器ID

docker换国内源加速

使用docker info可以查看到文件保存路径,和是否有换源:

root@UGREEN-A0E9:~# docker info
 Docker Root Dir: /mnt/dm-0/.ugreen_nas/6
 Registry: https://index.docker.io/v1/

nano /etc/docker/daemon.json 把以下内容复制进去:

{
    "registry-mirrors": [
        "https://y0xk2hg9.mirror.aliyuncs.com",
        "https://registry.hub.docker.com",
        "http://hub-mirror.c.163.com",
        "https://docker.mirrors.ustc.edu.cn",
        "https://registry.docker-cn.com"
    ]
}

重启systemctl restart docker, 检查docker info

代理

在构建 Docker 镜像时,如果需要通过代理访问外部网络资源(例如,安装软件包或依赖项),你可以通过以下几种方式设置代理:

1. 使用环境变量

你可以在 docker build 命令中使用 --build-arg 选项,传递代理相关的环境变量。

docker build \
  --build-arg http_proxy=http://your.proxy.server:port \
  --build-arg https_proxy=http://your.proxy.server:port \
  -t your-image-name .

在 Dockerfile 中,你需要使用 ARG 指令来声明这些构建参数,以便 Docker 在构建过程中能够使用它们:

ARG http_proxy
ARG https_proxy

# 继续其他 Dockerfile 指令...

2. 在 Docker 守护进程中配置全局代理

你也可以通过配置 Docker 守护进程,在全局范围内使用代理。具体操作步骤如下:

  1. 创建或编辑 /etc/systemd/system/docker.service.d/http-proxy.conf 文件(对于 HTTP 代理):

    [Service]
    Environment="HTTP_PROXY=http://your.proxy.server:port"
    Environment="HTTPS_PROXY=https://your.proxy.server:port"
    Environment="NO_PROXY=localhost,127.0.0.1"
    

  2. 重新加载守护进程配置,并重启 Docker:

    sudo systemctl daemon-reload
    sudo systemctl restart docker
    

  3. 通过 docker build 命令构建镜像时,Docker 守护进程会自动使用配置的代理。

3. 手动设置代理

在 Dockerfile 中直接设置代理环境变量:

ENV http_proxy=http://your.proxy.server:port
ENV https_proxy=http://your.proxy.server:port

# 继续其他 Dockerfile 指令...

4. 使用 ~/.docker/config.json

你还可以在 ~/.docker/config.json 文件中配置代理:

{
  "proxies": {
    "default": {
      "httpProxy": "http://your.proxy.server:port",
      "httpsProxy": "https://your.proxy.server:port",
      "noProxy": "localhost,127.0.0.1"
    }
  }
}

通过这些方法,你可以在 docker build 命令中使用代理,从而在需要外部网络资源的场景下顺利构建 Docker 镜像。

docker push/pull

  • It is in these containers that you will run or develop your code.
  • If you would like other people to be able to use your Docker image you can push to DockerHub (with docker push),
  • and if you want to use someone else’s image you can pull from DockerHub (with docker pull).3

网络问题

root@UGREEN-A0E9:~# docker pull dreamacro/clash
Using default tag: latest
Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled (Client.Timeout exceeded while awaiting headers)

需要换源

docker build

Then, run these commands to build a Docker image of your environment by using docker build.

Dockfile Path

docker build 基本的格式为 docker build [ 选项 ] 路径,该命令将读取指定路径下(包括子目录)的 Dockerfile,并将该路径下所有内容发送给 Docker 服务端,由服务端来创建镜像。因此一般建议放置 Dockerfile 的目录为空目录。也可以通过 .dockerignore 文件(每一行添加一条匹配模式)来让 Docker 忽略路径下的目录和文件。

option

option like

$ sudo docker build -t myrepo/myapp /tmp/test1/
$ docker build -t username/image_name:tag_name .

docker build use proxy

docker build --network=host\
    --build-arg http_proxy=http://127.0.0.1:7890 \
    --build-arg https_proxy=http://127.0.0.1:7890 \
    --build-arg "NO_PROXY=localhost,127.0.0.1,.example.com" \
    -t ithemal:latest .

You also can set the proxy in the Dockerfile.5

ENV http_proxy "http://127.0.0.1:7890"
ENV https_proxy "https://127.0.0.1:7890"

docker tag

镜像的完整 tag 不仅包含镜像名字, 还指明了镜像从哪里来, 要到哪里去, 就像一个 URL。可以通过 -t 选项指定镜像的标签信息,譬如:

$ docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]

docker run

Once successfully built, you can instantiate copies of this image as many times as you would like by using docker run to create Docker containers.

Container Lifecycle2

option
# 使用镜像nginx:latest以交互模式启动一个容器,在容器内执行/bin/bash命令。
$ docker run -it nginx:latest /bin/bash
# remove all stop container
$ docker container prune
  • -i: 以交互模式运行容器,通常与 -t 同时使用;
  • -t: 为容器重新分配一个伪输入终端,通常与 -i 同时使用;
  • -d: 后台运行容器,并返回容器ID;
  • -P: 随机端口映射,容器内部端口随机映射到主机的端口
  • -p: 指定端口映射,格式为:主机(宿主)端口:容器端口
  • --name="nginx-lb": 为容器指定一个名称;
  • -e username="ritchie": 设置环境变量;

docker Volumes

volumes allow me to interact with data outside of the docker container.

Volumes is better than bind mounts
  1. Volumes are easier to back up or migrate than bind mounts.
  2. Volumes work on both Linux and Windows containers. So option -v is better than --mount
options
docker run \
-v <path to datasets>:/datasets \
-v <path to approx-vision>:/approx-vision \
-it mbuckler/approx-vision \
/bin/bash

docker-compose

Compose 是用于定义和运行多容器 Docker 应用程序的工具。需要额外安装。通过 Compose,您可以使用 YML 文件来配置应用程序需要的所有服务。然后,使用一个命令,就可以从 YML 文件配置中创建并启动所有服务。

十分不建议使用docker-compose命令

使用root用户执行docker-compose up -d,不然会有文件权限问题。各种问题,软件版本问题等,十分折磨。

compose file
version: "3"

services:
  mihoyo-bbs:
    image: darkatse/mihoyo-bbs
    environment:
      - CRON_SIGNIN=30 9 * * *
      - MULTI=TRUE
    volumes: # 将主机的数据卷或着文件挂载到容器里。
      - .:/var/app
    logging: # driver:指定服务容器的日志记录驱动程序,默认值为json-file
      driver: "json-file"
      options:
        max-size: "1m" # 最多1m个文件,当达到文件限制上限,会自动删除旧得文件。

AutoMihoyoBBS4 将上述 YAML 文件保存为 docker-compose.yml,然后在包含该文件的目录中运行以下命令:

deploy

docker-compose logs -f命令来查看程序输出。 -f, --follow Follow log output

# docker-compose up 命令来启动并运行整个应用程序。
# docker-compose down 可以将整个应用停止并删除相关资源。
$ docker-compose up -d 
# 在后台执行该服务可以加上 -d 参数
Creating network "automihoyobbs_default" with the default driver
Pulling mihoyo-bbs (darkatse/mihoyo-bbs:)...
latest: Pulling from darkatse/mihoyo-bbs
df9b9388f04a: Pull complete
a1ef3e6b7a02: Pull complete
7a687728470e: Pull complete
4ecf30de1710: Pull complete
a1f99e431609: Pull complete
7e9141a60a66: Pull complete
7aa39aec04ec: Pull complete
a75b4b3d5690: Pull complete
dee0a6b07871: Pull complete
abed80702fed: Pull complete
Digest: sha256:10958801df87675c390a8cdcc153c2f87a41af92d35f9f2cf9b7758aa3e10d1b
Status: Downloaded newer image for darkatse/mihoyo-bbs:latest
Creating automihoyobbs_mihoyo-bbs_1 ... done

实例

AllForOne 脚本
#!/bin/bash
docker_name="mihoyo-bbs"
docker stop ${docker_name}
docker rm ${docker_name}
echo -e "\033[5;36mOrz 旧容器(镜像)已清理\033[0m"

time_now=$(date "+%m%d%H")
docker build -f dockerfile --tag ${docker_name}:"${time_now}" .
echo -e "\033[5;36mOrz 镜像重建完成\033[0m"

docker run -itd \
    --name ${docker_name} \
    --log-opt max-size=1m \
    -v $(pwd):/var/app \
    ${docker_name}:"${time_now}"
echo -e "\033[5;36mOrz 镜像启动完成\033[0m"
docker ps -a #顯示目前的 container 及狀態
docker logs ${docker_name} -f # -f, --follow         Follow log output
hackergame2020 的源码的dockerfile

奇怪的使用

启动docker并通过xhost保持tmux连接

  • docker/docker_connect.sh 或者 https://blog.csdn.net/winter2121/article/details/118223637
  • What if I want to use X forwarding from within a Docker container?3

Docker of VNC

在Linux服务器上使用Docker运行图形化界面的应用程序。为了实现这一点,您需要使用一个特别配置的Docker镜像,该镜像支持图形用户界面(GUI)。这通常涉及到安装一个桌面环境和任何必要的图形驱动程序。

以下是实现这一目的的基本步骤:

  1. 选择一个合适的基础镜像:您可以从一个已经包含了桌面环境的基础镜像开始,例如Ubuntu或Fedora。
  2. 安装图形界面:在Dockerfile中,您可以安装一个桌面环境,如GNOME、KDE或Xfce,以及任何其他必需的软件。
  3. 配置X11或其他显示服务器:为了让图形界面能够显示,您需要配置X11或类似的显示服务器。这可能涉及到暴露和映射一些端口,以及安装和配置VNC服务器或其他远程桌面软件。
  4. 运行容器并连接到图形界面:一旦容器运行起来,您需要通过VNC客户端或其他远程桌面工具连接到它。

这里是一个示例的Dockerfile,用于创建一个带有图形界面的Ubuntu容器:

FROM ubuntu:latest

# 安装必要的软件包
RUN apt-get update && apt-get install -y \
    ubuntu-desktop \
    vnc4server \
    xterm

# 设置VNC服务器
RUN mkdir /root/.vnc
RUN echo "your-password" | vncpasswd -f > /root/.vnc/passwd
RUN chmod 600 /root/.vnc/passwd

# 设置VNC启动脚本
COPY vnc_startup.sh /root/vnc_startup.sh
RUN chmod +x /root/vnc_startup.sh

# 暴露VNC端口
EXPOSE 5900

CMD ["/root/vnc_startup.sh"]

在这个Dockerfile中,ubuntu-desktopvnc4server被安装,以便提供图形界面和VNC访问。您需要创建一个VNC启动脚本(vnc_startup.sh),以启动VNC服务器并运行桌面环境。

请注意,运行图形界面的容器通常比标准的、无GUI的容器更加资源密集,并且可能需要更多的存储空间和内存。此外,确保遵循最佳安全实践,特别是在暴露VNC或其他远程访问服务时。

常见问题

Got permission denied while trying to connect to the Docker daemon socket
  1. sudo 运行
  2. 加入docker用户组
sudo groupadd docker     #添加docker用户组
sudo usermod -aG docker $USER #将登陆用户加入到docker用户组中
sudo gpasswd -a $USER docker    # or
groups # 重新登录查看是否生效
newgrp docker     #更新用户组
docker ps    #测试docker命令是否可以使用sudo正常使用
failed to create endpoint portainer on network bridge: adding interface xxx to bridge yyy failed: Device does not exist.

gpt's solution的无效答案

这个错误表明 Docker 在创建容器时遇到了问题,具体原因是无法将网络接口 veth2c573cd 添加到 Docker 网络桥 docker0,并且提示设备不存在。

查看 Docker 网络列表,确保相关的网络(可能是 bridge)存在:

docker network ls

如果不存在,你可以尝试删除并重新创建:

docker network rm yyy
docker network create yyy

然后再次运行你的 Docker 容器。

sudo password in docker image

link 1 2 3

参考文献

https://cloud.tencent.com/developer/article/1395434


  1. How can Docker run distros with different kernels? 

  2. Docker Commands for Managing Container Lifecycle (Definitive Guide) 

  3. Developing in Docker 

  4. https://github.com/Womsxd/AutoMihoyoBBS 

  5. https://cloud.tencent.com/developer/article/1806455 & http://www.debugself.com/2018/01/17/docker_network/ 

Visualization Ranking

Goal

横向条形图排序赛跑叫Bar chart race

visualization using echart

  1. 完整的中文官方教程和丰富的插件和相关项目
  2. 可以支持vue
  3. 支持动态折线图和动态柱状图

visualization using d3.js

参考项目

但是好像是静态的,而且只有一个排序的柱状图

visualization using anichart

参考文档, 使用template项目

git clone https://github.com/Kirrito-k423/leetcode-ranking-visualization-anichart.git

# Install Dependencies
npm install -g pnpm
pnpm i
pnpm build # error

由于项目还在开发,暂时不进一步尝试

需要进一步的研究学习

暂无

遇到的问题

暂无

开题缘由、总结、反思、吐槽~~

参考文献

GccOnWin10

路线

MinGW

  • MinGW(Minimalist GNU for Windows),又称mingw32,是将GCC编译器和GNU Binutils移植到Win32平台下的产物,包括一系列头文件(Win32API)、库和可执行文件。
  • 另有可用于产生32位及64位Windows可执行文件的MinGW-w64项目,是从原本MinGW产生的分支。如今已经独立发展
  • 安装gcc
  • MinGW Installation Manager 中 勾选gcc/g++ make gdb 等项
  • 貌似只能安装在C盘(这很不好
  • 但是如果安装的是便携版的git bash,就没有上述程序。

MSYS2

  • MSYS2是一组工具和库,为您构建、安装和运行本机Windows软件提供了一个易于使用的环境。
  • 包括类似
  • 命令行终端mintty、bash、
  • git和Subversion 版本控制系统、
  • tar和awk 工具,
  • AutoTools 构建系统,
  • Pacman的包管理系统, 来提供包的轻松安装和保持更新的方式,Arch Linux用户应该很熟悉这个系统。
  • 强大的功能: 例如依赖项解析和简单的完整系统升级,以及直接和可重复的包构建
  • 程序包库包含2800多个准备安装的预构建程序包。
  • 所有这些都是基于Cygwin的修改版本。尽管其中一些核心部分是基于Cygwin的,但MSYS2的主要关注点是为本地Windows软件提供一个build环境,并将使用Cygwin的部分保持在最低限度。
  • MSYS2为GCC、Mingw-W64、CPython、CMake、Meson、openssl、FFmpeg、Rust、Ruby等提供了最新的native builds。

Clang and GDB using MSYS2

  • MSYS2 Installation
  • 图形化界面自定义安装路径
  • 打开MSYS2 MSYS安装软件
        # 更新包管理 输入Y继续
        pacman -Syu
        # 安装 UCRT(Universal C Runtime)  版本的 clang gdb
        pacman -S --needed base-devel mingw-w64-ucrt-x86_64-clang mingw-w64-ucrt-x86_64-gdb
    
  • VSCODE 添加到MSYS2 MinGW UCRT 64-bit终端的路径下。 CTRL+O CTRL+X 保存退出
    • bash cd ~ nano .bashrc export PATH=$PATH:/e/commonSoftware/Microsoft\ VS\ Code/bin
    • 终端里code .就能打开
  • 或者系统路径添加E:\commonSoftware\msys32\ucrt64\bin VSCODE 就能正常访问g++

无法识别库

存在红色波浪线, 插件clangd导致的

无法点击头文件跳转

  • 激活跳转
  • 安装C/C++插件
  • 设置includePath
  • Ctrl+Shift+P输入C/C++ 编辑配置
  • 添加E:\\commonSoftware\\msys32\\ucrt64\\include

需求

  • 笔记本有g++, 台式机没有
  • vscode能顺利识别调用,并且gdb
    D:\PowerShell> which g++
    /c/Program Files/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/g++
    

需要进一步的研究学习

暂无

遇到的问题

暂无

开题缘由、总结、反思、吐槽~~

  • 原本我从来不配置Windows的编译器的,直到服务器zfs挂壁了
  • 看来还是要靠自己~

参考文献

https://solarianprogrammer.com/2021/06/11/install-clang-windows-msys2-mingw-w64/

https://blog.csdn.net/m0_51429482/article/details/125191731

Codeforces & Topcoder

简介

  • codeforces
  • Codeforces 是一家为计算机编程爱好者提供的在线评测系统
  • 该网站由俄罗斯 ITMO 大学(圣彼得堡国家信息技术、机械学与光学研究型大学)的一个团体创立并负责运营。
  • 在编程挑战赛中,选手有 2 个小时的时间去解决 5 道题,通过得分排名,选手可以看到实时的排名(Standing),也可以选择查看好友的排名,还可以看到某题有多少人通过等信息。
  • 在 cf,所有的用户根据在以往比赛中的表现被赋予一个 Rating 并冠以不同的头衔,名字也会以不同的颜色显示,比如 Expert 是蓝色,Master 是黄色。
  • 题目兼容并蓄,什么难度等级的题目都可以找到。
    • 并且题目很有意思,往往思维陷阱比较多,也就是思维题比较多。
    • 对于数据结构以及算法的考察相对弱一些,更多的时候往往是告诉你用什么算法你也不知道怎么做。
  • topcoder
  • TopCoder成立于2001年,它的客户包括Google、MS、YAHOO、Intel、 Motorola和SUN等世界上顶级的IT公司。每年TopCoder都会举办若干个编程竞赛和锦标赛,其总奖金金额高达几十万美元。她是你进入世界顶级的IT企业的捷径,TopCoder排名(程序设计,开发,算法)靠前的选手基本都成了知名公司追逐的对象。
  • 积分:tc的每个用户(handle)都有自己的积分,从0-3000+不等。成绩越好,分数越高 。
  • 积分与颜色的对应为:白色——未参赛(unrated);灰色——0899;绿色——9001199;蓝色——12001499;黄色——15002199;红色——2200+。另外排名最高的几个人在TC客户端中会变成红色靶子图标。现在,全世界有300人达到红色等级,日本有26人。3000 分以上者被称为target,全世界有18人,日本有3人,分别是:iwi(秋叶拓哉)、wata (岩田阳一)和lvrically;

topcoder vs codeforces

Codeforces: Another good platform with nice contests where you will get to learn new things that will improve your understanding of concepts. It's ratings don't matter to recruiters but the things you'll learn will help you during interviews and company's coding tests.

TOPCODER: This caters to every aspect of software develpment. They have both designing and development contest. Major companies provide Topcoder community to experment with their nw products or APIs. But if you want to mention it in your CV, your ratings should be above 1400 to impress a recruiter.

for average is CODEFORCES, for expert TOPCODER

竞赛说明

codeforces

  • 比赛举办频率
  • 第一种是Codeforces Rounds(常规比赛) 大约一周一两次,时长2小时。常规赛分为三个赛区:Div3、Div2和Div1。题目难度Div3 < Div2 < Div1。
  • 第二种是Educational Contests(教育性比赛) 大约每个月二到三次,时长2个小时。常规赛分为两个赛区:Div2和Div1。题目难度Div2 < Div1。
  • 比赛一般是两个小时的赛程,一共六道题目。(20分钟一题)
  • 新手能做出3道,rating就不会跌。
  • div 表示题目难度,数值越小难度越高,
  • div 1 要求参赛者的 Rating 大于 1900 。div2 平均难度在 Rating 1500.
  • Hack:当你通过某题目,可以查看同房间内其他通过该题的参赛者的代码。
  • 由于codeforces在比赛的时候只会测试一小部分数据,真正的测试集会放到赛后进行测试。所以在比赛中测试通过的代码,只是通过了小数据验证,很有可能有隐藏的问题没被发现。
  • 如果发现了bug,可以构造一份数据hack掉他的提交。
  • hack 成功,你获得 100 分奖励,别人的提交会被打回;hack 失败,减 50 分作为惩罚。
  • 一般后面题不会做的时候,又有时间的时候就去Hack

topcoder

  • 安装程序TopCoder Arena(竞技场,古罗马的斗兽场也是这个词),
  • TopCoder Arena是一个纯Java应用程序,它既是Applet也是应用程序,所以需要安装Java运行环境。
  • 相关软件的网址ContestAppletProd.jnlp(Java Web Start 方式安装)
  • 规则
  • 75分钟做完3道难度递增的题。(25 mins per problem)
  • 比赛分为两个division:Div I和Div II。
    • 积分<1200或者unrated(即注册但还没参加过比赛的)参加Div II,>=1200的参加Div I。
    • Div I的题要比Div II难许多。 一般DivII的最后一题和Div I的第一或第二题是一样的。
    • 无论是Div I或Div II。三道题目的Score一般为250, 500和1000左右,视每次的难度略有浮动。
  • 个人积分 (rating)的增减是根据你和别人在比赛中的score以及你们原来的rating决定的。tc 的提交结合了ICPC和IOI的特点,即只能交一次,必须过所有数据并且得分与用时相关。tc每周有一次Single Round Match(SRM),每年两次大的比赛TCOpen(有$)。
    • 评分是根据你完成的时间和所完成问题的难易决定的。
  • 比赛可分为三部分:Coding Phase, Challenge Phase和System Test Phase
    • 发送代码后,你就进入Challenge Phase了,Challenge Phase部分是让参赛者浏览分配在同一房间的其他参赛者的源代码,然后设法找出其中错误,并提出一个测试参数使其不能通过测试。如果某参赛者的程序不能通过别人或系统的测试,则该参赛者在此题目的得分将为0。
    • System Test Phase: 挑战结束后,TopCoder会测试每个参赛者的代码,如果你的代码产生了不正确的输出、异常终止和其它错误,你就不能得分。
  • 如果是多个回合比赛,每个小组中得分最高的三位参赛者将进入下一轮的比赛。他们将解决一些新的问题,最后总得分在前三名的选手将会得到现金奖励。
  • 参赛具体操作, 图文

other platform

codechef

Actual experience

codeforces

  1. 22:35PM - 01:05 AM

topcoder

  1. Contest time infomation is here.
  2. SRM 849 on September 28, 2023 at 11:00 AM - 1:00 PM EST(UTC-4). (00:00 AM - 2:00 AM UTC+8)
  3. hard to read due to the tiny font.
  4. maybe copy the problem to outside

需要进一步的研究学习

暂无

遇到的问题

暂无

开题缘由、总结、反思、吐槽~~

参考文献

https://blog.csdn.net/qiuzhenguang/article/details/5552122

https://zhuanlan.zhihu.com/p/540098105

cmake

导言

ipcc初赛的项目代码有些混乱,只是简单分类。想好好学习一下cmake和make。规范项目结构,优化编译运行流程,提高效率。

Docker On Win10

简介

  • WSL 2 是对WSL基础体系结构的一次重大改造,它使用虚拟化技术和 Linux 内核来实现其新功能。
  • docker是基于linux内核运行
  • WSL 2 加入了linux内核为docker在windows上运行铺平了道路

系统要求

开启虚拟化 + Hyper-V

  • BIOS开启虚拟化
  • 查看是否开启:任务管理器 -> 性能 -> CPU 虚拟化:开启
  • Control Panel(控制面板) -> Programs and Features(程序和功能) -> Turn Windows Features on or off(启用或关闭Widnows功能)勾选三项
  • Windows Hypervisor Platform(Windows虚拟机监控程序平台)
  • Hyper-V
  • 虚拟机平台
  • 管理员Powershell运行 bcdedit /set hypervisorlaunchtype auto
  • 重启

WSL 2

参考教程安装 WSL旧版 WSL 的手动安装步骤

# 查看当前版本
 wsl -l -v
  NAME            STATE           VERSION
* Ubuntu-20.04    Stopped         1

 wsl --set-version Ubuntu-20.04 2
正在进行转换,这可能需要几分钟时间。
操作成功完成。

E:/PowerShell via  v14.17.3 via 🐍 v3.9.7 took 59s
 wsl -l -v
  NAME            STATE           VERSION
* Ubuntu-20.04    Stopped         2

docker on Windows

注意:用命令行运行来修改默认安装路径(重命名install.exe),参考教程

.\Docker.exe install --installation-dir="E:\commonSoftware\Docker"
安装完之后运行设置 * 开启开机启动 * 在Resources里修改image保存路径

使用问题

1: read-only file system

Error response from daemon: container df6ee73697883e8e09edd65404e1fcc19a2b4bfb49212c754a8b3ef9741d7bda: driver "overlay2" failed to remove root filesystem: unlinkat /var/lib/docker/overlay2/475c350b02589ce2cb5ef30f0619ed3aeaba409c56d87191b8cbbd00ef618fe3: read-only file system
需要管理员运行docker

C盘没空间

WSL还是超级占用C盘

需要进一步的研究学习

暂无

遇到的问题

暂无

开题缘由、总结、反思、吐槽~~

参考文献

https://blog.csdn.net/Antarctic_Bear/article/details/123489609

Linux Auto Run : crontab

crontab的使用

任务调度

Linux下的任务调度分为两类:系统任务调度和用户任务调度。

Linux系统任务是由 cron (crond) 这个系统服务来控制的,这个系统服务是默认启动的。用户自己设置的计划任务则使用crontab 命令。

crontab 命令

crontab [-u user] file
crontab [ -u user ] [ -i ] { -e | -l | -r }
  • -u user:用于设定某个用户的crontab服务;
  • file: file为命令文件名,表示将file作为crontab的任务列表文件并载入crontab;
  • -e:编辑某个用户的crontab文件内容,如不指定用户则表示当前用户;
  • -l:显示某个用户的crontab文件内容,如不指定用户则表示当前用户;
  • -r:从/var/spool/cron目录中删除某个用户的crontab文件。
  • -i:在删除用户的crontab文件时给确认提示。

crontab文件

  • crontab有2种编辑方式:
    • 直接编辑/etc/crontab文件,其中/etc/crontab里的计划任务是系统中的计划任务,
    • 通过crontab –e来编辑用户的计划任务;
      • 每次编辑完某个用户的cron设置后,cron自动在/var/spool/cron下生成一个与此用户同名的文件,此用户的cron信息都记录在这个文件中,这个文件是不可以直接编辑的,只可以用crontab -e 来编辑。
      • 所有用户定义的crontab 文件都被保存在 /var/spool/cron目录中。其文件名与用户名一致。
  • crontab中的command尽量使用绝对路径,否则会经常因为路径错误导致任务无法执行。
  • 新创建的cron job不会马上执行,至少要等2分钟才能执行,可从起cron来立即执行。
  • %在crontab文件中表示“换行”,因此假如脚本或命令含有%,需要使用\%来进行转义。

配置文件实例:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
HOME=/
MAILTO=root # MAILTO变量指定了crond的任务执行信息将通过电子邮件发送给root用户,如果MAILTO变量的值为空,则表示不发送任务执行信息给用户
# * * * * * user-name command to be executed
@reboot /home/user/test.sh #可以实现开机自动运行
@reboot sleep 300 && /home/start.sh # 延时启动

@reboot 表示重启开机的时候运行一次。还有很多类似参数如下:

string             meaning
------          -----------
@reboot      Run once, at startup.
@yearly       Run once a year, "0 0 1 1 *".
@annually    (same as @yearly)
@monthly    Run once a month, "0 0 1 * *".
@weekly     Run once a week, "0 0 * * 0".
@daily        Run once a day, "0 0 * * *".
@midnight   (same as @daily)
@hourly      Run once an hour, "0 * * * *".
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |

*  */1  *  *  *  /etc/init.d/smb restart  # 每一小时重启smb

在以上各个字段中,还可以使用以下特殊字符:

  • *代表所有的取值范围内的数字,如月份字段为*,则表示1到12个月;
  • /代表每一定时间间隔的意思,如分钟字段为*/10,表示每10分钟执行1次。
  • -代表从某个区间范围,是闭区间。如2-5表示2,3,4,5
    • 组合:小时字段中0-23/2表示在0~23点范围内每2个小时执行一次。
  • ,分散的数字(不一定连续),如1,2,3,4,7,9

查看crontab的日志记录和状态

tail -f /var/log/cron观察查看cron运行日志(/var/log/cron.log),但是并未找到相关文件,原因是ubuntu默认没有开cron日志,执行命令:

sudo vim /etc/rsyslog.d/50-default.conf
找到cron.log相关行,将前面注释符#去掉,保存退出,重启rsyslog:
sudo  service rsyslog  restart
执行less -10 /var/log/cron.log再次查看cron运行日志,log出来了,提示如下信息:
No MTA installed, discarding output
原因是cron把屏幕输出都发送到email了,而当前环境并未安装email server,于是系统报错,解决方面就是不要直接向屏幕输出内容,而是重定向到一个文件。

cd /var/spool/mail/
less shaojiemike
service cron status # ubuntu

crontab on OpenWRT

# 1.编辑好脚本加入cron

crontab -e
* * * * * sh /root/tst.sh

# 2.创建cron初始化脚本 vi /etc/init.d/S60cron,添加下面内容

#!/bin/sh
#start crond
/usr/sbin/crond -c /etc/crontabs

# 修改权限
chmod 755 /etc/init.d/S60cron

# 3.手动启动crond
/etc/init.d/S60cron

# 4.查看crond任务
logread -e cron

# 5.重启crond
killall crond; /etc/init.d/S60cron

# 6.禁用crond日志 修改/etc/init.d/S60cron
/usr/sbin/crond -c /etc/crontabs -L /dev/null

crontab运行push-IP脚本

git-push脚本

https://git.ustc.edu.cn/supertan/autoupdateipconfig

Linux 开机自动运行脚本的其他方法

https://zhuanlan.zhihu.com/p/35402730

https://blog.csdn.net/qq_35440678/article/details/80489102

https://neucrack.com/p/91

需要进一步的研究学习

登录终端自动运行

可以用户登录的时候显示信息,记录信息,静止某些IP登录 https://cloud.tencent.com/developer/article/1416251

遇到的问题

开题缘由、总结、反思、吐槽~~

最近遇到了一堆机器,想白嫖,但是如果不是自己的机器,因为某些原因重启,IP变动就再也连接不上了。所以需要一个自启动push-IP的脚本,特此学习一下。

参考文献

https://www.linuxprobe.com/how-to-crontab.html

https://martybugs.net/wireless/openwrt/cron.cgi