Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
titlecrontab may fail for sudo

cron may fail silently for above command on some installations, since we use the sudo command in our scripts. To enable sudo commands to run in cron, you need to disable requiretty. Run visudo command, and comment out the line: Defaults requiretty

For more details on this read: http://unix.stackexchange.com/questions/49077/why-does-cron-silently-fail-to-run-sudo-stuff-in-my-script

 

...

Code Block
languagebash
titleAuto delete of old files
# Add this entry in crontab to delete files older than 15 days from /backup folder (every evening at 6 PM)
00 18 * * * /usr/bin/find /backup -type f -mtime +15 -exec /bin/rm -f {} \;

For more examples on crontab entries read this: crontab

...