Cron Daily problem / new user Topic is solved

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
hpkoopmann@gmail.com
Posts: 2
Joined: Mon Jul 20, 2020 11:38 pm

Cron Daily problem / new user

Post by hpkoopmann@gmail.com »

Hi,

i'm quite new to linux. I just wanted to execute an easy script via "dietpi-cron" on my raspberry pi zero w.
It should work as alarm clock for me, so it should start at an given time once a day.
I configured the "dietpi-cron" feature accordingly and but the script in the folder "/etc/cron.daily".
Of course the script is owned by me (root) and is was set to be executable.
The file ist called "wecker" (with no extension).

When i execute it manually via "sh wecker" or "./wecker" everything works.

The script contains just the follwoing lines, and should start up my Yamaha multiroom system as a alarm clock.
This can be done by an simple html-API, which i checked several times. You can easily do that with a browser.

So, here is the simple Script:

#!/bin/bash
wget -q http://192.168.178.33/YamahaExtendedCon ... wer=toggle

Is there something i missed? Or someting i did not understand?
As i understand, the file has to be placed in the "/etc/cron.daily" folder and then i need to configure the time
with "dietpi-cron". correct?

Could someone help me out?

Thanks

H.P.
User avatar
Joulinar
Posts: 2044
Joined: Sat Nov 16, 2019 12:49 am

Re: Cron Daily problem / new user

Post by Joulinar »

Hi,

many thanks for your request. You could verify if your script will be executed as follow

Code: Select all

run-parts --list /etc/cron.daily
This will list all scripts that will be done within the daily execution.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
hpkoopmann@gmail.com
Posts: 2
Joined: Mon Jul 20, 2020 11:38 pm

Re: Cron Daily problem / new user

Post by hpkoopmann@gmail.com »

Hi,

last night i found out more: It is a time problem, the script works fine!
I tried to set the test-alarm to 23.05 yesterday but with no effect.
I went to bed then, but the speaker started to play at 0:05, so an hour late.

I just tried it out to set an test-alarm with this hour in mind (so 6:57 instead of 7:57) and it worked fine.

When i check the date/time at the promt ("date" command) the clock is set correctly.
Why does the cron feature uses an other time?
When i configured the pi there was only an regional option ("Berlin/Germany" in my case) but no
feature like summer- or wintertime. But the internal system clock is set correctly anyway...

This explanies an other thing happend yesterday. I tried out "crontab" instead of "Dietpi-Cron".
The only thing which worked, was to start the script "every 5 minutes" or so, but not with an exact time.
Now i know why.... cron uses the wrong time....

Does anyone know a solution?

EDIT:
For some reason it works now at the correct times. Everything is fine!
I installed "pi Hole" this morning and during that installation a re-start was made, which solved the time problem somehow.
I did restarts yesterday too, but somehow this one set the clock....

Thanks
Post Reply