crontab + rsync not working

  • Hi there!


    tl;dr: trying to schedule rsync job using crontab via SSH, but doesn't work - system specs at the end.


    GOAL


    As I've already stated here, I try to get LibreELEC to do automatic backups from one of my connected hard drives to another. The final goal is to synchronize a specific folder on hard drive A with a specific folder on hard drive B (both connected via USB) once a week.


    In the linked thread I've been suggested to schedule a cron job that calls rsync periodically.

    Here's what I've done so far:

    - connected to LibreELEC via SSH - works!

    - tested rsync by issuing the following command directly in shell: rsync -avzP /var/media/Volume/Music /var/media/Backup/Music - works!

    - tried to set up cron job by adding a file to /etc/cron.d - does not work, because 'read-only file system' :(

    - tested crontab -e by adding 25 16 * * * reboot - works!


    PROBLEM


    No here's the problem. The solution to my problem would obviously be to run 'crontab -e' and add i.e.


    25 16 * * * root rsync -avzP /var/media/Volume/Music /var/media/Backup/Music


    (of course that does not run the command weekly but daily, but that's what I've tested to see if it works immediately)


    QUESTIONS


    That command does not do anything though. Do I have and error in the command or what's the problem?


    Also, is there any kind of log or error output by the active cron jobs I can access for debugging? I've read that I can add a line saying 'MAILTO:root' to the crontab to send the command output to the root user's mail folder, but where do I even find that?


    SYSTEM


    Raspberry Pi 4 b
    LibreELEC 9.1.502
    Kodi 18.4


    Thanks!


    blibso

  • Iridium

    Approved the thread.
  • You can't set user with busybox cron: OpenWrt Project: Cron and crontab

    Quote

    Task specification

    Each line is a separate task written in the specification:

    Code
    1. * * * * * command to execute
    2. - - - - -
    3. | | | | |
    4. | | | | ----- Day of week (0 - 6) (Sunday =0)
    5. | | | ------- Month (1 - 12)
    6. | | --------- Day (1 - 31)
    7. | ----------- Hour (0 - 23)
    8. ------------- Minute (0 - 59)


    Support my work with small (or big) Paypal donation


    Amlogic devices works better with CoreELEC

    Blu-ray Disc Java menus support - forum thread, Github

    my lamp addon (unofficial/community with limited support)
    my touchscreen support and instructions by Grruhn (now touchscreen addon exists in repository)


  • Hi vpeter!


    Thanks for the response!

    Unfortunately, I just tried it without the 'root', so with the following line:


    20 13 * * * rsync -avzP /var/media/Volume/test /var/media/Backup


    Still doesn't work :(

    (while the rsync command works if I test it directly in the shell)


    Also, does anybody have an idea regarding the crontab log output?

  • Then try to use full path for rsync which is probably /storage/.kodi/addons/virtual.network-tools/bin/rsync.


    Logs:

    Code
    1. systemctl status cron -l
    2. journalctl -l --no-pager


    Support my work with small (or big) Paypal donation


    Amlogic devices works better with CoreELEC

    Blu-ray Disc Java menus support - forum thread, Github

    my lamp addon (unofficial/community with limited support)
    my touchscreen support and instructions by Grruhn (now touchscreen addon exists in repository)