linux - Sh script not running using cron while running using terminal manually
问题描述
I have a script .sh that works when executed manually but not working through cron :
#!/bin/sh
sudo find . -name "*.log" -delete
There are other .sh which runs perfectly with cron.
I don't know why this one doesn't work.
I compared the env output from the terminal and from cron and both are similar beside the user which has higher privilege in cron using :
echo env > output.txt
The only difference between this script and others which work is the location of the file.
If anyone had a similar problem or know how to get more precise logs.
Thank you in advance
解决方案
正如@Shawn 和@user1834428 在评论中提到的“。” 在我的脚本中没有指向我想要的地方。
推荐阅读
- c# - 从 Google 检索 GPS/DMS 坐标
- powershell - 如何使用 SharePointPnP 通过 PowerShell 获取租户属性?
- git - 将工件(如文件)上传到 git(bitbucket)
- javascript - 向下滚动页面以获取 JS puppeter 中的所有元素
- android - 使用 Kotlin 将编辑文本的内容发送到电子邮件或文本的按钮
- discord.py-rewrite - 如何将机器人连接到语音通道?
- nservicebus - netcore 3.1 启动中的 NServiceBus 配置
- hibernate - 多对多关系正在创建一个我不想创建的新实例
- css - 放大/缩小响应式案例
- javascript - javascript/jquery 循环遍历 html 内容并替换