cron.hourly

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
pakikje
Posts: 124
Joined: Fri Nov 11, 2016 3:04 pm

cron.hourly

Post by pakikje »

Hello guys,

I added a bash-script to /etc/cron.hourly but it doesn't run at all (script is ok). I did a chmod +x on this script. How do i work this?

ps: i wrote (and tested) the script as root. I just did a crontab -l and got the message that there is no chrontab for root...
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: cron.hourly

Post by Fourdee »

pakikje wrote:Hello guys,

I added a bash-script to /etc/cron.hourly but it doesn't run at all (script is ok). I did a chmod +x on this script. How do i work this?

ps: i wrote (and tested) the script as root. I just did a crontab -l and got the message that there is no chrontab for root...
If you want to use a crontab, you need to create a crontab:

Code: Select all

crontab -e
Select Nano as editor.

If the script executes by simply running:

Code: Select all

/etc/cron.hourly/mycronjob
Then its working and will be executed every hour.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
pakikje
Posts: 124
Joined: Fri Nov 11, 2016 3:04 pm

Re: cron.hourly

Post by pakikje »

I worked it out by removing the ".sh" extension of the script. Cron doesn't like a dot :-)
Post Reply