问题描述
Siteground托管,Cron作业和Linux的新手。
我在WordPress网站上有一个目录要删除30天以上的文件。
Linux shell命令是
find path/to/files/* -mtime +30 -exec rm {} \;
问题与使用路径有关。我不知道该Cron作业从何处运行。
如果我只用创建一个cron作业
find *
日志文件产生以下结果...
tmp
tmp/somefile1
tmp/somefile2
etc...
tmp在哪里?我应该在路径中使用什么命令来到达所需位置。
如果我使用FileZilla FTP到我的站点,则这是有问题的目录的路径...
/mydomain.com/public_html/sr
因此,如果我编辑Cron作业以执行以下命令...
find /mydomain.com/public_html/sr/*
我明白了
find: '/mydomain.com/public_html/sr/*': No such file or directory
因此,只是不确定如何为我的Cron作业指定路径,以使其在所需目录上运行。
解决方法
经过大量搜索后找到了答案。
/home/customer/www/yourdomain.com/public_html/sr
希望这对其他人有帮助。这种支持根本没有帮助。