1

I'm struggling to create a scheduled job in cron to send the directory size to an email address. This is what I've got so far

crontab -e

* * * * * du -s /path/to/dir | mail -s "test" [email protected]

as I understand it, this should send an email every minute but its not?

1 Answer 1

2

you cannot rely on the PATH variable in the crontab file and should use full path to the programs you intend to run. you may easily find the full paths using:

which du
which mail

and prepend the commands in your crontab file with the correct paths.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.