From 49e721cff0b8b221f749674d8829c88c3bc2dc72 Mon Sep 17 00:00:00 2001 From: AhFei Date: Thu, 12 Jan 2023 23:41:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E3=80=82=E4=B8=93=E7=94=A8?= =?UTF-8?q?=E4=BA=8E=E7=BB=83=E4=B9=A0=E6=B5=8B=E8=AF=95=E7=9A=84=E6=9C=BA?= =?UTF-8?q?=E5=AD=90=E5=88=9D=E5=A7=8B=E5=8C=96=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RNinitial.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 RNinitial.sh diff --git a/RNinitial.sh b/RNinitial.sh new file mode 100644 index 0000000..0b5cebe --- /dev/null +++ b/RNinitial.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# initial the system + +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +# step 1: install +echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf #修改系统变量 +echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf #修改系统变量 +sysctl -p #保存生效 +sysctl net.ipv4.tcp_available_congestion_control #执行 + +apt -y install sudo wget curl ufw screen vim git python3-pip +curl -fsSL https://get.docker.com | bash -s docker >${PWD}/step1 2>&1 +curl -L https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose +echo "step 1: install has finished" + +# step 2: localize +useradd -d /home/skf -m SkF%16_6 +usermod -s /bin/bash SkF%16_6 +usermod -aG sudo SkF%16_6 # 有些发行版 RN 的就没有sudo adm +usermod -aG adm SkF%16_6 +usermod -aG docker SkF%16_6 && newgrp docker +echo `groups SkF%16_6` + +timedatectl set-timezone Asia/Shanghai +echo `date` + +echo "step 2: localize has finished" + +# step 3: monitor + +mkdir -p /root/myserve/serverstatus && wget --no-check-certificate -qO /root/myserve/serverstatus/client-linux.py 'https://raw.githubusercontent.com/cppla/ServerStatus/master/clients/client-linux.py' +nohup python3 /root/myserve/serverstatus/client-linux.py SERVER=serverstatus.ahfei.blog USER=ahfei-rn PASSWORD=A23456.. >/dev/null 2>&1 & +echo "@reboot python3 /root/myserve/serverstatus/client-linux.py SERVER=serverstatus.ahfei.blog USER=ahfei-rn PASSWORD=A23456.. >/dev/null 2>&1" >> /var/spool/cron/crontabs/root + +echo "step 3: monitor has finished" \ No newline at end of file