更新 scripts/system_optimize.sh
This commit is contained in:
parent
d1edf86d41
commit
0c3926312f
|
|
@ -66,7 +66,7 @@ synchronize_hardware_clock() {
|
||||||
off_sleep(){
|
off_sleep(){
|
||||||
log_info "[05]-执行关闭系统休眠操作中"
|
log_info "[05]-执行关闭系统休眠操作中"
|
||||||
systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target &>> /tmp/2.log
|
systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target &>> /tmp/2.log
|
||||||
log_info "[05]-执行关闭系统休眠操作--------------已完成!"
|
log_info "[05]-执行关闭系统休眠操作---------------已完成!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -93,9 +93,9 @@ lock_current_kernel(){
|
||||||
cp -f "$GRUB_FILE" "${GRUB_FILE}.bak"
|
cp -f "$GRUB_FILE" "${GRUB_FILE}.bak"
|
||||||
sed -i '/GRUB_DEFAULT=/c\GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux '${CURRENT_KERNEL}'"' "$GRUB_FILE"
|
sed -i '/GRUB_DEFAULT=/c\GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux '${CURRENT_KERNEL}'"' "$GRUB_FILE"
|
||||||
update-grub &>/dev/null
|
update-grub &>/dev/null
|
||||||
log_info "[06]-执行系统内核锁定操作-------------------已完成!"
|
log_info "[06]-执行系统内核锁定操作---------------已完成!"
|
||||||
else
|
else
|
||||||
log_info "[06]-执行系统内核锁定操作-------------------已完成!"
|
log_info "[06]-执行系统内核锁定操作---------------已完成!"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -178,7 +178,7 @@ rename_hostname(){
|
||||||
log_info "[09]-执行修改主机名称操作中"
|
log_info "[09]-执行修改主机名称操作中"
|
||||||
IP=$(ip addr | awk '/^[0-9]+: / {}; /inet.*global/ {print gensub(/(.*)\/(.*)/, "\\1", "g", $2)}' | grep `ip route | grep default | awk '{print $3}' | awk -F. '{print $1"."$2}' | head -1` | head -1 | sed 's/\./-/g')
|
IP=$(ip addr | awk '/^[0-9]+: / {}; /inet.*global/ {print gensub(/(.*)\/(.*)/, "\\1", "g", $2)}' | grep `ip route | grep default | awk '{print $3}' | awk -F. '{print $1"."$2}' | head -1` | head -1 | sed 's/\./-/g')
|
||||||
hostnamectl set-hostname ${IP}
|
hostnamectl set-hostname ${IP}
|
||||||
log_info "[09]-主机名称修改操作------------------已完成!"
|
log_info "[09]-主机名称修改操作-------------------已完成!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -188,7 +188,7 @@ clear_history(){
|
||||||
log_info "[10]-执行清理历史命令操作中"
|
log_info "[10]-执行清理历史命令操作中"
|
||||||
> ~/.bash_history
|
> ~/.bash_history
|
||||||
history -c
|
history -c
|
||||||
log_info "[10]-执行清理历史命令------------------已完成!"
|
log_info "[10]-执行清理历史命令-------------------已完成!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue