Having issues with your DietPi installation, or, found a bug? Post it here.
trendy
Posts: 188 Joined: Tue Feb 25, 2020 2:54 pm
Post
by trendy » Sun Jul 19, 2020 9:27 am
I added a few cronjobs in dietpi user crontab (with 'crontab -e')
Code: Select all
15 5 * * * /usr/bin/touch /mnt/backup/magiatiko/test-$(date +%F)
16 5 * * * /usr/bin/scp root@magiatiko:/tmp/backup-magiatiko-$(date +%F).tar.gz /mnt/backup/magiatiko/
20 5 * * * /usr/bin/find /mnt/backup/magiatiko -type f -mtime +30 -exec rm -f {} \;
21 5 * * * /usr/bin/find /mnt/backup/kodi -type f -mtime +30 -exec rm -f {} \;
I added the first one to verify that it indeed works, but no file is created.
All commands run successfully when run from shell as user dietpi.
Am I missing something?
Last edited by
trendy on Tue Jul 21, 2020 1:59 pm, edited 1 time in total.
Joulinar
Posts: 3177 Joined: Sat Nov 16, 2019 12:49 am
Post
by Joulinar » Sun Jul 19, 2020 1:01 pm
Did you tried to place inside root user crontab?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
trendy
Posts: 188 Joined: Tue Feb 25, 2020 2:54 pm
Post
by trendy » Tue Jul 21, 2020 12:44 pm
No, because I don't want to run the commands as root user.
Doesn't the dietpi user crontab work?
Joulinar
Posts: 3177 Joined: Sat Nov 16, 2019 12:49 am
Post
by Joulinar » Tue Jul 21, 2020 1:15 pm
it was more for testing purposes to check if it's working at all
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
trendy
Posts: 188 Joined: Tue Feb 25, 2020 2:54 pm
Post
by trendy » Tue Jul 21, 2020 1:58 pm
It is not working for root either.
I added the first job (with touch) and it was not created.
Joulinar
Posts: 3177 Joined: Sat Nov 16, 2019 12:49 am
Post
by Joulinar » Tue Jul 21, 2020 9:52 pm
ok I created a cron job for this night on one of my test RPi systems. let's see how it's going
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Joulinar
Posts: 3177 Joined: Sat Nov 16, 2019 12:49 am
Post
by Joulinar » Wed Jul 22, 2020 11:02 am
Hi
@trendy
I did a test entry on my
crontab for user
dietpi
Code: Select all
dietpi@DietPi3:~$ crontab -l
00 00 * * * date > /tmp/date.log
dietpi@DietPi3:~$
And for me it was working fine. The file was created at Midnight as expected
Code: Select all
root@DietPi3:/tmp# ls -la |grep date.log
-rw-r--r-- 1 dietpi dietpi 30 Jul 22 00:00 date.log
root@DietPi3:/tmp# cat date.log
Wed Jul 22 00:00:01 CEST 2020
root@DietPi3:/tmp#
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
trendy
Posts: 188 Joined: Tue Feb 25, 2020 2:54 pm
Post
by trendy » Wed Jul 22, 2020 12:21 pm
Your date command worked for me as well.
I think there is something wrong with the special characters in my commands, therefore let's mark it as solved. Thank you for the tip!
Joulinar
Posts: 3177 Joined: Sat Nov 16, 2019 12:49 am
Post
by Joulinar » Wed Jul 22, 2020 1:10 pm
Just an idea. Place you commands into a script and let the script be executed by crontab.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
trendy
Posts: 188 Joined: Tue Feb 25, 2020 2:54 pm
Post
by trendy » Wed Jul 22, 2020 1:54 pm
I was trying to avoid that, not to have many different scripts. If I fail to escape the special characters correctly, I'll resort to that.