Linux 拦截 reboot 命令
拦截用户输入的 reboot 命令,防止手滑输入成reboot导致服务器重启
把下面代码写入到 /etc/profile 内,并执行一次 source /etc/profile
# 自定义一个 func
sendya_reboot() {
while true
do
echo -n "You really want to restart the server? (yes/no):"
read crm
if [ "$crm"x = "yes"x ]; then
echo "rebooting"
\reboot
else
break
fi
break
done
}
# 别名
alias reboot='sendya_reboot'
Copyright © 2013-2024 8a.hk All Rights Reserved. 八艾云 版权所有 中山市八艾云计算有限公司 粤ICP备14095776号 粤公网安备 44200002445359号
增值电信业务经营许可证编号:B1-20222012
代理域名注册服务机构:西部数码