[SOLVED] Daily cron script is not executed Topic is solved

Having issues with your DietPi installation or found a bug? Post it here.
Post Reply
twilight
Posts: 19
Joined: Mon May 23, 2016 5:40 pm

[SOLVED] Daily cron script is not executed

Post by twilight »

Hi,

I have set up a script in the /etc/cron.daily folder which is not executed for some reason.

Image

This is the script, I have blurred out the upload to my personal ftp server and switched to github.

Image

I 've already tested it executing it directly and have ssh keys deployed on github, no passphrase is asked even after reboot, so it should run ok, but it is not.
Last edited by twilight on Mon Dec 21, 2020 10:17 am, edited 1 time in total.
User avatar
Joulinar
Posts: 4823
Joined: Sat Nov 16, 2019 12:49 am

Re: Daily cron script is not executed

Post by Joulinar »

Hi,

did you checked to have the script located directly inside /etc/cron.daily and not using a symlink. As well you can have a look what will be executed as follow

Code: Select all

run-parts --list /etc/cron.daily
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
twilight
Posts: 19
Joined: Mon May 23, 2016 5:40 pm

Re: Daily cron script is not executed

Post by twilight »

Code: Select all

dietpi@DietPiZero:~$ run-parts --list /etc/cron.daily/
/etc/cron.daily//apt-compat
/etc/cron.daily//aptitude
/etc/cron.daily//dietpi
/etc/cron.daily//dpkg
/etc/cron.daily//passwd
/etc/cron.daily//samba
/etc/cron.daily//updater
It is symlinked, but will try to have it inside the directory directly. Its the "updater" script.
twilight
Posts: 19
Joined: Mon May 23, 2016 5:40 pm

Re: Daily cron script is not executed

Post by twilight »

Looks like even this didn't work. I mean copying and pasting the script directly into the cron.daily folder.
User avatar
Joulinar
Posts: 4823
Joined: Sat Nov 16, 2019 12:49 am

Re: Daily cron script is not executed

Post by Joulinar »

you could run run-parts --test /etc/cron.daily to check which scrits are going to be executed. And using run-parts /etc/cron.daily to actually have them executed. As well you can have a look if cron is executed at all journalctl -u cron.service or systemctl status cron.service

Btw: if you don't like to play with all daily cron jobs, you can move your script into /etc/cron.monthly: Usually it should be empty.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
twilight
Posts: 19
Joined: Mon May 23, 2016 5:40 pm

Re: [SOLVED] Daily cron script is not executed

Post by twilight »

I 'll mark this thread as solved. Reason for this is that I had to deploy ssh keys ALSO into the root user.
User avatar
Joulinar
Posts: 4823
Joined: Sat Nov 16, 2019 12:49 am

Re: [SOLVED] Daily cron script is not executed

Post by Joulinar »

ah indeed, cron is executed as root user. Makes sense to have the SSH key deployed on root user as well :)
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply