您的位置:首页 > 其它

不停服务清空nohup.out日志文件脚本

2018-01-19 17:52 381 查看
备份nohup日志文件脚本在nohup.out 目录下新建nohup_backup.sh 并复制如下代码
#!/bin/bashtoday=`date +"%Y%m%d"`newfile="nohup$today.out"echo "Backup log file"echo "Start copy nohup.out to $newfile ..."cp nohup.out $newfileecho "Copy $newfile finished"echo "Start clear nohup.out ..."cp /dev/null nohup.outecho "Clear nohup.out finished"

执行: ./nohup_backup.sh该脚本会把当前的nohup.out文件先复制为nohupxxxx-yy-mm.out 然后清空nohup.out文件。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  nohup清空