[英]crontab is not deleting the files in linux
我正在尝试删除11:30 PM超过30天的所有pdf文件
我在crontab中添加了以下给定的代码
30 23 * * * find /var/www/html/site/reports/ -name "*.pdf" -type f -mtime +30 | xargs -I {} rm -f {} \;
但是它不会删除文件。
您能检查一下问题是什么吗?
crontab的详细信息
-rw-r--r--. 1 root root 532 Sep 30 11:14 crontab
我需要删除的文件之一
-rw-r--r-- 1 apache apache 15215 Jul 25 11:24 sales_report.pdf
您错过了用户和PATH。 这可能会有所帮助
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
30 23 * * * root find /var/www/html/site/reports/ \( -name "*.pdf" \) -type f -mtime +30 -exec rm {} \; >> /tmp/debug_cron 2>&1
然后检查/ tmp / debug_cron
我有这个工作的Linux盒子。
30 23 * * * find /var/www/html/site/reports/ \( -name "*.pdf" \) -type f -mtime +30 -exec rm {} \;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.