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@domain.com

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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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