Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

If I create a script and then place it in this folder (/etc/cron.hourly), will my system run this script hourly? Or does my script need to begin with a command as well?

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

Yep, you got it.

Just start it with a #!/bin/bash like you normally would. And make sure you sudo chmod +x /etc/cron.hourly/yourscript because it won't run without execute permissions.

share|improve this answer
add comment

Anything in /etc/cron.hourly will be executed hourly, just like anything in /etc/cron.daily will be run once a day.

Make sure the file is executable, and start it with #!/bin/bash or #!/usr/bin/python (or #!/usr/bin/env python) or whatever is appropriate for the type of script you'll be running.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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