Strictly for learning purposes (possibly maintenance as well) I am trying to have a Cron job empty my trash once a day.
I have opened terminal and entered the command crontab -e
to access the VI editor to add the command. I've entered Insert mode and added * * * * * sudo rm -rf ~/.Trash/*
, hit the escape key to exit and quit VI with :wq!
This particular script I have running every minute just to see if it works and it is not. I thought it might be an issue with cron not having root access, so I added the same line to the sudo crontab -e
file and it doesn't seem to be saving.
Any ideas what could be wrong with this cron job?
.Trash
withsudo
in the first place? Is your sudoers configuration set to NOPASSWD?