linux和windown定时删除tomcat logs脚本
1、在root/目录下拉入deLog.sh文件(可以参考删除logs定时器)。
注:若脚本为Windows版本,需要转换为linux版本才可在linux使用,(转换方法可以参考windowns脚本转换为linux脚本)
2、查看Tomcat logs(上传的文件deLog.sh) 路径是否正确 wq/q 保存或者退出
[root@localhost ~]# vim deLog.sh
3、 执行deLog.sh文件 显示以下内容(启动成功):
[root@localhost ~]# sh deLog.sh
4、在linux上创建计划任务。以root用户的计划任务为例。
[root@localhost ~]# crontab -e
##计划任务文件内容如下:
05 21 * * * sh /root/delLog.sh > /root/del_Log.log 2>&1
##内容含义:
##每天21:05运行执行/root/delLog.sh脚本,并将屏幕输出内容写入到/root/del_Log.log文件中。
完成后输入 :wq 回车后保存退出。
5、查看验证计划任务
[root@localhost ~]# crontab -l