Cron作业Linux Shell命令SiteGround-它在哪个目录中运行?

问题描述

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

希望这对其他人有帮助。这种支持根本没有帮助。

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...