用户名参数化

main
AhFei 2023-01-13 00:56:34 +08:00
parent 17b2a756f2
commit adbaa2dd42
1 changed files with 11 additions and 11 deletions

View File

@ -24,12 +24,12 @@ echo "step 1: install has finished"
# step 2: localize # step 2: localize
useradd -d /home/skf -m SkF%16_6 useradd -d /home/skf -m ${1}
usermod -s /bin/bash SkF%16_6 usermod -s /bin/bash ${1}
usermod -aG sudo SkF%16_6 # 有些发行版 RN 的就没有sudo adm usermod -aG sudo ${1} # 有些发行版 RN 的就没有sudo adm
usermod -aG adm SkF%16_6 usermod -aG adm ${1}
usermod -aG docker SkF%16_6 && newgrp docker usermod -aG docker ${1} && newgrp docker
echo `groups SkF%16_6` echo `groups ${1}`
timedatectl set-timezone Asia/Shanghai timedatectl set-timezone Asia/Shanghai
echo `date` echo `date`
@ -38,12 +38,12 @@ echo "step 2: localize has finished"
# step 3: monitor # step 3: monitor
mkdir -p ~SkF%16_6/myserve/serverstatus && wget --no-check-certificate -qO ~SkF%16_6/myserve/serverstatus/client-linux.py 'https://raw.githubusercontent.com/cppla/ServerStatus/master/clients/client-linux.py' mkdir -p ~${1}/myserve/serverstatus && wget --no-check-certificate -qO ~${1}/myserve/serverstatus/client-linux.py 'https://raw.githubusercontent.com/cppla/ServerStatus/master/clients/client-linux.py'
chown -R SkF%16_6:SkF%16_6 ~SkF%16_6/myserve chown -R ${1}:${1} ~${1}/myserve
nohup python3 ~SkF%16_6/myserve/serverstatus/client-linux.py SERVER=serverstatus.ahfei.blog USER=ahfei-${1} PASSWORD=A23456.. >/dev/null 2>&1 & nohup python3 ~${1}/myserve/serverstatus/client-linux.py SERVER=serverstatus.ahfei.blog USER=ahfei-${2} PASSWORD=A23456.. >/dev/null 2>&1 &
echo "@reboot python3 /root/myserve/serverstatus/client-linux.py SERVER=serverstatus.ahfei.blog USER=ahfei-${1} PASSWORD=A23456.. >/dev/null 2>&1" >> /var/spool/cron/crontabs/SkF%16_6 echo "@reboot python3 ~${1}/myserve/serverstatus/client-linux.py SERVER=serverstatus.ahfei.blog USER=ahfei-${2} PASSWORD=A23456.. >/dev/null 2>&1" >> /var/spool/cron/crontabs/${1}
echo "step 3: monitor has finished" echo "step 3: monitor has finished"