Using CRON hourly, daily folders

Built into most crontabs is the functionality to run scripts hourly, daily, weekly or monthly. All that is requires is that you create a bash file and place it in a folder. It will automagically run – no CRON reload. There are a few tricks.

  • The file cannot have an extension or spaces
  • The file must be executable.

The folders are

  • /etc/cron.hourly
  • /etc/cron.daily
  • /etc/cron.weekly
  • /ect/cron.monthly

You can check if the file is accepted by running

run-parts --test /etc/cron.hourly

For example.

touch /etc/cron.hourly/backuptos3
chmod +x /etc/cron.hourly/backuptos3
vim /etc/cron.hourly/backuptos3

done

Leave a Reply

Your email address will not be published. Required fields are marked *