rockylinux打造全功能服务器 (rocky linux可做服务器吗)

rockylinux优缺点,rockylinux打造全功能服务器

rockylinux优缺点,rockylinux打造全功能服务器

推荐

一键安装mysql8.0(Rocky Linux 9/CentOS Stream 9)(shell)

一键安装redis6.0(Rocky Linux 9/CentOS Stream 9)(shell)

一键安装mongodb_4.2(Rocky Linux 9/CentOS Stream 9)(shell)

一键安装rabbitMQ.3.12(Rocky Linux 9/CentOS Stream 9)(shell)

一键安装nginx.1.19.6(Rocky Linux 9/CentOS Stream 9)(shell)

一/编写脚本

[root@R9-10-0-1-3 opt]# cd /etc/profile.d/
[root@R9-10-0-1-3 profile.d]# cat /etc/profile.d/hk_year_month_day.sh
#!/bin/bash

current_year_reduce=$(date +%Y)
current_year=$(date +%Y)
current_month=$((10#$(date +%m)))
current_day=$((10#$(date +%d)))
#当月减一个月
next_month_reduce=$((current_month - 1))
#判四季
if ((1 <= current_month && current_month <= 3)); then
    quarter="Spr"
elif ((4 <= current_month && current_month <= 6)); then
    quarter="Sum"
elif ((7 <= current_month && current_month <= 9)); then
    quarter="Fal"
elif ((10 <= current_month && current_month <= 12)); then
    quarter="Win"
else
    quarter="NO"
fi
#判0月
if [ $next_month_reduce -lt 1 ]; then
    next_month_reduce=12
    current_year_reduce=$((current_year_reduce - 1))
fi
#取少一月
next_date_reduce=$(sudo printf "%04d%02d" $current_year_reduce $next_month_reduce)
#年加密
encryption=$(sudo echo -n "$current_year" | base64 | sha256sum |head -c 20)
extracted_string=${encryption:9:5}
#最后密码
wodemm="DE${extracted_string}@AB{next_date_reduce}${quarter}"
#判断root
if [ $(id -u) = "0" ];then
      sudo passwd <<EOF
$wodemm
$wodemm
EOF
fi

二/设置定时任务

[root@R9-10-0-1-2 ~]# crontab -l
1 1 1 * * bash /etc/profile.d/hk_year_month_day.sh  > /dev/null 2