目前在docker容器中执行的 crontab命令删除定期删除/tmp 目录
命令如下:
# 进行临时目录磁盘清理
1 0 * * * source ~/.bash_profile; find /tmp/ -mtime +5 -type f -exec rm -rf {} \ >/dev/null 2>&1
观察发现没有执行,运行发现报此错误
find: missing argument to `-exec'
查资料发现 \后面需要 ;
正确写法如下:
1 0 * * * source ~/.bash_profile; find /tmp/ -mtime +5 -type f -exec rm -rf {} \; >/dev/null 2>&1
附录find - exex 后面意思:
-exec 找到后执行命令
rm -rf {}命令就是删除文件
;这是格式要求的,没有具体含义。