Skip to content
Advertisement

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

Advertisement

Answer

As mentioned by @Shawn and @user1834428 in the comment the “.” in my script was not pointing where I wanted.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement