清除日志shell脚本
2016-06-23 17:58
537 查看
#!/bin/bash
#清除日志脚本
LOG_DIR=/var/log
ROOT_UID=0 #$UID为0的时候,用户具有root用户的权限
if [ "$UID" -ne "$ROOT_UID" ]
then
echo "Must be root to run this script"
exit 1
fi
cd $LOG_DIR || { #|| 失败的意思
echo "cannot change to necessary directory " >&2
exit 1
}
cat /dev/null >messages &&echo "logs cleaned up"
exit 0
#清除日志脚本
LOG_DIR=/var/log
ROOT_UID=0 #$UID为0的时候,用户具有root用户的权限
if [ "$UID" -ne "$ROOT_UID" ]
then
echo "Must be root to run this script"
exit 1
fi
cd $LOG_DIR || { #|| 失败的意思
echo "cannot change to necessary directory " >&2
exit 1
}
cat /dev/null >messages &&echo "logs cleaned up"
exit 0
相关文章推荐
- jquery中change()用法实例分析
- 清理SQL Server 2008日志文件Cannot shrink log file 2 的解决方案
- Cannot modify header information错误解决方法
- php出现Cannot modify header information问题的解决方法大全
- js change,propertychange,input事件小议
- javascript的onchange事件与jQuery的change()方法比较
- PHP错误Warning: Cannot modify header information - headers already sent by解决方法
- phpmyadmin出现Cannot start session without errors问题解决方法
- the import cannot be resolved
- Slave failed to initialize relay log info structure from the repository
- VMware Workstation 运行出错 Could not open /dev/vmmon
- ubuntu更改网卡设备名称
- SQL SERVER2008 忘記SA密碼怎麼辦
- su: warning: cannot change directory to /home/mysql: 权限不够 -bash: /home/mysql/.ba
- JSF发生Cannot find FacesContext的处理方法
- vc6-2-expression cannot be evaluated
- ORACLE下Change命令
- Nginx – Enable PHP-FPM Status Page
- Data Recovery Advisor(数据恢复顾问)
- 在使用svn或者git时解决冲突后打不开工程文件的解决方法