sudo -H bash -c "test -d /tmp || (mkdir -p /tmp && chown root:$(id -g -n root) /tmp)"
sudo -H bash -c "test -d /tmp/tiup || (mkdir -p /tmp/tiup && chown root:$(id -g -n root) /tmp/tiup)"
sudo -H bash -c "test -d /tmp/tiup/bin || (mkdir -p /tmp/tiup/bin && chown root:$(id -g -n root) /tmp/tiup/bin)"
sudo -H bash -c "sysctl -a"
sudo -H bash -c "grep -E '^\s*SELINUX=enforcing' /etc/selinux/config 2>/dev/null | wc -l"
sudo -H bash -c "if [ -d /sys/kernel/mm/transparent_hugepage ]; then cat /sys/kernel/mm/transparent_hugepage/{enabled,defrag}; fi"
sudo -H bash -c "systemctl list-unit-files --type service | grep -i irqbalance.service | wc -l"
sudo -H bash -c "systemctl status irqbalance.service"
sudo -H bash -c "systemctl list-unit-files --type service | grep -i firewalld.service | wc -l"
sudo -H bash -c "systemctl status firewalld.service"
sudo -H -u root bash -c "id -u test > /dev/null 2>&1 || (/usr/sbin/groupadd -f test && /usr/sbin/useradd -m -s /bin/bash -g test test) && echo 'test ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/test"
sudo -H -u root bash -c "su - test -c 'test -d ~/.ssh || mkdir -p ~/.ssh && chmod 700 ~/.ssh'"
sudo -H -u root bash -c "grep -Ev '^\s*#|^\s*$' /etc/ssh/sshd_config"
sudo -H -u root bash -c "su - test -c 'grep $(echo ssh-rsa <key-content>) ~/.ssh/authorized_keys || echo ssh-rsa <key-content> >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys'"
sudo -H -u root bash -c "test -d <dir> || (mkdir -p <dir> && chown <user>:$(id -g -n <user>) <dir>)"sudo -H -u root bash -c "mv /tmp/<component>-<hash>.service /etc/systemd/system/<component>.service"
sudo -H -u root bash -c "systemctl daemon-reload && systemctl start <component>.service && systemctl enable <component>.service"
sudo -H -u root bash -c "systemctl daemon-reload && systemctl restart <component>.service"
sudo -H -u root bash -c "systemctl daemon-reload && systemctl stop <component>.service"sudo -H -u root bash -c "rm -rf <dirs> /etc/systemd/system/<component>.service;"
评论